3 bup_python="$(dirname "$0")/bup-python" || exit $?
4 exec "$bup_python" "$0" ${1+"$@"}
8 import os, sys, subprocess, struct
10 from bup import options
11 from bup.helpers import debug1, debug2, mux
14 # Give the subcommand exclusive access to stdin.
15 orig_stdin = os.dup(0)
16 devnull = os.open('/dev/null', os.O_RDONLY)
21 bup mux command [arguments...]
24 o = options.Options(optspec)
25 (opt, flags, extra) = o.parse(sys.argv[1:])
27 o.fatal('command is required')
31 debug2('bup mux: starting %r\n' % (extra,))
33 outr, outw = os.pipe()
34 errr, errw = os.pipe()
39 p = subprocess.Popen(subcmd, stdin=orig_stdin, stdout=outw, stderr=errw,
43 sys.stdout.write('BUPMUX')
45 mux(p, sys.stdout.fileno(), outr, errr)
51 debug1('%s exited with code %d\n' % (extra[0], prv))
53 debug1('bup mux: done\n')