2 import os, sys, subprocess, struct
3 from bup import options
4 from bup.helpers import *
7 bup mux command [command arguments...]
10 o = options.Options(optspec)
11 (opt, flags, extra) = o.parse(sys.argv[1:])
13 o.fatal('command is required')
15 cmdpath, cmdfn = os.path.split(__file__)
17 subcmd[0] = os.path.join(cmdpath, 'bup-' + subcmd[0])
19 debug2('bup mux: starting %r\n' % (extra,))
21 outr, outw = os.pipe()
22 errr, errw = os.pipe()
26 p = subprocess.Popen(subcmd, stdout=outw, stderr=errw, preexec_fn=close_fds)
29 sys.stdout.write('BUPMUX')
31 mux(p, sys.stdout.fileno(), outr, errr)
37 debug1('%s exited with code %d\n' % (extra[0], prv))
39 debug1('bup mux: done\n')