From: Ian Jackson Date: Wed, 7 Dec 2005 18:59:54 +0000 (+0000) Subject: process mangling X-Git-Tag: converted-from-bzr~102 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=9891bfd7ca4cca278ca3d58a50f457b69bbc0e43;p=autopkgtest.git process mangling --- diff --git a/virt-chroot/adt-virt-chroot b/virt-chroot/adt-virt-chroot index f969b1d..b00f6d0 100755 --- a/virt-chroot/adt-virt-chroot +++ b/virt-chroot/adt-virt-chroot @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2.4 # usage: # adt-virt-chroot =[CHROOTNAME] # uses dchroot (but problems with spaces) @@ -11,6 +11,7 @@ import sys import string import urllib import signal +import subprocess from optparse import OptionParser debuglevel = None @@ -69,7 +70,12 @@ def cmd_quit(c, cu): def cmd_open(c, cu): cmdnoargs(c, cu) if downtmp: bomb("`open' when already open") - downtmp = sys.exec + (dt, err) = + subpocess.Popen(args = down + 'mktemp -t -d'.split(), + stdin=PIPE, stdout=PIPE) + .communicate() + if err: bomb("down mktemp failed: %s" % err) + downtmp = dt.rstrip("\n") def command(): cu = sys.stdin.readline() @@ -88,7 +94,11 @@ def cleanup(): global downtmp, cleaning cleaning = True if downtmp: - pass + (x, err) = subprocess.Popen(args = down + + 'rm -rf --'.split() + [downtmp], + stdin=PIPE, stdout=PIPE) + .communicate() + if err: bomb("down rm -rf downtmp failed: %s" % err) cleaning = False def prepare(): @@ -115,19 +125,3 @@ except Quit, q: except: cleanup() raise - -# open) -# [ "x$downtmp" = x ] || fail '"open" when already open' -# downtmp="$($down mktemp -t -d)" -# echo ok -# ;; -# 'stop *') -# -# -# *) -# fail "unrecognised command $command" -# ;; -# esac -# done -# -# fail 'unexpected EOF on control channel'