aboutsummaryrefslogtreecommitdiff
path: root/utils/command_executer.py
diff options
context:
space:
mode:
authorLuis Lozano <llozano@chromium.org>2013-03-15 14:44:13 -0700
committerChromeBot <chrome-bot@google.com>2013-03-15 15:51:37 -0700
commitf81680c018729fd4499e1e200d04b48c4b90127c (patch)
tree940608da8374604b82edfdb2d7df55d065f05d4c /utils/command_executer.py
parent2296ee0b914aba5bba07becab4ff68884ce9b8a5 (diff)
downloadtoolchain-utils-f81680c018729fd4499e1e200d04b48c4b90127c.tar.gz
Cleaned up directory after copy of tools from perforce directory
Got rid of stale copies of some tools like "crosperf" and moved all files under v14 directory (that came from perforce) into the top directory. BUG=None TEST=None Change-Id: I408d17a36ceb00e74db71403d2351fd466a14f8e Reviewed-on: https://gerrit-int.chromium.org/33887 Tested-by: Luis Lozano <llozano@chromium.org> Reviewed-by: Yunlian Jiang <yunlian@google.com> Commit-Queue: Luis Lozano <llozano@chromium.org>
Diffstat (limited to 'utils/command_executer.py')
-rw-r--r--utils/command_executer.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/utils/command_executer.py b/utils/command_executer.py
index 3edb6262..0aedc47c 100644
--- a/utils/command_executer.py
+++ b/utils/command_executer.py
@@ -74,11 +74,14 @@ class CommandExecuter:
out = err = None
pipes = [p.stdout, p.stderr]
+ my_poll = select.poll()
+ my_poll.register(p.stdout, select.POLLIN)
+ my_poll.register(p.stderr, select.POLLIN)
+
terminated_time = None
started_time = time.time()
while len(pipes):
- fds = select.select(pipes, [], [], 0.1)
if command_terminator and command_terminator.IsTerminated():
self.RunCommand("sudo kill -9 " + str(p.pid),
print_to_console=print_to_console)
@@ -88,21 +91,25 @@ class CommandExecuter:
return (p.wait, full_stdout, full_stderr)
else:
return wait
- for fd in fds[0]:
- if fd == p.stdout:
+
+ l=my_poll.poll(100)
+ for (fd, evt) in l:
+ if fd == p.stdout.fileno():
out = os.read(p.stdout.fileno(), 16384)
if return_output:
full_stdout += out
self.logger.LogCommandOutput(out, print_to_console)
if out == "":
pipes.remove(p.stdout)
- if fd == p.stderr:
+ my_poll.unregister(p.stdout)
+ if fd == p.stderr.fileno():
err = os.read(p.stderr.fileno(), 16384)
if return_output:
full_stderr += err
self.logger.LogCommandError(err, print_to_console)
if err == "":
pipes.remove(p.stderr)
+ my_poll.unregister(p.stderr)
if p.poll() is not None:
if terminated_time is None: