X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fmux-cmd.py;h=3b5524415e5f916bfd03b846494cfc8bccc3ed69;hb=HEAD;hp=b70c0a8eeaa538c3ca1026afe1753e756d6257dd;hpb=c7139a3fae51633f0f290ebf73f0cf5e4864e547;p=bup.git diff --git a/cmd/mux-cmd.py b/cmd/mux-cmd.py deleted file mode 100755 index b70c0a8..0000000 --- a/cmd/mux-cmd.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env python -import os, sys, subprocess, struct -from bup import options -from bup.helpers import * - -# Give the subcommand exclusive access to stdin. -orig_stdin = os.dup(0) -devnull = os.open('/dev/null', os.O_RDONLY) -os.dup2(devnull, 0) -os.close(devnull) - -optspec = """ -bup mux command [arguments...] --- -""" -o = options.Options(optspec) -(opt, flags, extra) = o.parse(sys.argv[1:]) -if len(extra) < 1: - o.fatal('command is required') - -subcmd = extra - -debug2('bup mux: starting %r\n' % (extra,)) - -outr, outw = os.pipe() -errr, errw = os.pipe() -def close_fds(): - os.close(outr) - os.close(errr) - -p = subprocess.Popen(subcmd, stdin=orig_stdin, stdout=outw, stderr=errw, - preexec_fn=close_fds) -os.close(outw) -os.close(errw) -sys.stdout.write('BUPMUX') -sys.stdout.flush() -mux(p, sys.stdout.fileno(), outr, errr) -os.close(outr) -os.close(errr) -prv = p.wait() - -if prv: - debug1('%s exited with code %d\n' % (extra[0], prv)) - -debug1('bup mux: done\n') - -sys.exit(prv)