aboutsummaryrefslogtreecommitdiff
path: root/python/ContextKit/cltool.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/ContextKit/cltool.py')
-rw-r--r--python/ContextKit/cltool.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/python/ContextKit/cltool.py b/python/ContextKit/cltool.py
index 454b5101..8051aadc 100644
--- a/python/ContextKit/cltool.py
+++ b/python/ContextKit/cltool.py
@@ -66,7 +66,7 @@ class CLTool:
def __init__(self, *cline):
self.process = Popen(cline, stdin=PIPE, stdout=PIPE, stderr=STDOUT,
- preexec_fn=self._preexec)
+ preexec_fn=self._preexec, close_fds=True)
self.io = []
self.iolock = Lock()
self.reader = Reader(self)
@@ -97,8 +97,12 @@ class CLTool:
"""Writes STRING to the standard input of the child."""
with self.iolock:
self.io.append((time.time(), CLTool.STDIN, string))
- print >>self.process.stdin, string
- self.process.stdin.flush()
+ try:
+ print >>self.process.stdin, string
+ self.process.stdin.flush()
+ except:
+ self.printio()
+ raise
def _return_event(self, wantdump):
with self.iolock: