From a6393d5baa635739672fe2561dafea30f8f2652c Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Mon, 9 Feb 2009 02:00:22 +0000 Subject: revert subprocess changes for the moment as well git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5070 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Client/Tools/__init__.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/lib/Client/Tools/__init__.py b/src/lib/Client/Tools/__init__.py index ad0740992..d44356f9b 100644 --- a/src/lib/Client/Tools/__init__.py +++ b/src/lib/Client/Tools/__init__.py @@ -9,24 +9,16 @@ __all__ = ["Action", "APT", "Blast", "Chkconfig", "DebInit", "Encap", drivers = [item for item in __all__ if item not in ['rpmtools']] default = [item for item in drivers if item not in ['RPM', 'Yum']] -import os -try: - from subprocess import Popen -except: - from popen2 import Popen4 as Popen -import stat -import sys -import time -import Bcfg2.Client.XML +import os, popen2, stat, sys, Bcfg2.Client.XML, time class toolInstantiationError(Exception): '''This error is called if the toolset cannot be instantiated''' pass -class readonlypipe(Popen): +class readonlypipe(popen2.Popen4): '''This pipe sets up stdin --> /dev/null''' def __init__(self, cmd, bufsize=-1): - self.__module__._cleanup() + popen2._cleanup() c2pread, c2pwrite = os.pipe() null = open('/dev/null', 'w+') self.pid = os.fork() @@ -39,7 +31,7 @@ class readonlypipe(Popen): self._run_child(cmd) os.close(c2pwrite) self.fromchild = os.fdopen(c2pread, 'r', bufsize) - self.__module__._active.append(self) + popen2._active.append(self) class executor: '''this class runs stuff for us''' -- cgit v1.2.3-1-g7c22