2 import os, sys, subprocess, struct
3 from bup import options
4 from bup.helpers import *
6 # Give the subcommand exclusive access to stdin.
8 devnull = os.open('/dev/null', os.O_RDONLY)
13 bup mux command [arguments...]
16 o = options.Options(optspec)
17 (opt, flags, extra) = o.parse(sys.argv[1:])
19 o.fatal('command is required')
23 debug2('bup mux: starting %r\n' % (extra,))
25 outr, outw = os.pipe()
26 errr, errw = os.pipe()
31 p = subprocess.Popen(subcmd, stdin=orig_stdin, stdout=outw, stderr=errw,
35 sys.stdout.write('BUPMUX')
37 mux(p, sys.stdout.fileno(), outr, errr)
43 debug1('%s exited with code %d\n' % (extra[0], prv))
45 debug1('bup mux: done\n')