3 bup_python="$(dirname "$0")/bup-python" || exit $?
4 exec "$bup_python" "$0" ${1+"$@"}
8 from __future__ import absolute_import
9 import os, sys, subprocess, struct
11 from bup import options
12 from bup.helpers import debug1, debug2, mux
15 # Give the subcommand exclusive access to stdin.
16 orig_stdin = os.dup(0)
17 devnull = os.open('/dev/null', os.O_RDONLY)
22 bup mux command [arguments...]
25 o = options.Options(optspec)
26 (opt, flags, extra) = o.parse(sys.argv[1:])
28 o.fatal('command is required')
32 debug2('bup mux: starting %r\n' % (extra,))
34 outr, outw = os.pipe()
35 errr, errw = os.pipe()
40 p = subprocess.Popen(subcmd, stdin=orig_stdin, stdout=outw, stderr=errw,
44 sys.stdout.write('BUPMUX')
46 mux(p, sys.stdout.fileno(), outr, errr)
52 debug1('%s exited with code %d\n' % (extra[0], prv))
54 debug1('bup mux: done\n')