projects
/
deliverable
/
lttng-ivc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add timeout to run
[deliverable/lttng-ivc.git]
/
lttng_ivc
/
utils
/
runtime.py
diff --git
a/lttng_ivc/utils/runtime.py
b/lttng_ivc/utils/runtime.py
index 264addc67f8667263071605658253faddaaad571..d8a2de62018e52a8ccffba8b1a90358f392fc129 100644
(file)
--- a/
lttng_ivc/utils/runtime.py
+++ b/
lttng_ivc/utils/runtime.py
@@
-141,7
+141,7
@@
class Runtime(object):
_logger.debug("Spawned sub pid: {} args: {} stdout: {} stderr{}".format(p.pid, p.args, out_path, err_path))
return tmp_id
_logger.debug("Spawned sub pid: {} args: {} stdout: {} stderr{}".format(p.pid, p.args, out_path, err_path))
return tmp_id
- def run(self, command_line, cwd=None, check_return=True, ld_preload="", classpath=""):
+ def run(self, command_line, cwd=None, check_return=True, ld_preload="", classpath=""
, timeout=None
):
"""
Run the command and return a tuple of a (CompletedProcess, stdout_path,
stderr_path). The subprocess is already executed and returned. The
"""
Run the command and return a tuple of a (CompletedProcess, stdout_path,
stderr_path). The subprocess is already executed and returned. The
@@
-173,7
+173,8
@@
class Runtime(object):
for key, value in env.items():
env_out.write('{}={}\n'.format(key, value))
for key, value in env.items():
env_out.write('{}={}\n'.format(key, value))
- cp = subprocess.run(args, stdout=stdout, stderr=stderr, env=env, cwd=cwd)
+ cp = subprocess.run(args, stdout=stdout, stderr=stderr, env=env,
+ cwd=cwd, timeout=timeout)
_logger.debug("Command #{} args: {} stdout: {} stderr{}".format(tmp_id, cp.args, out_path, err_path))
# Add to the global log file. This can help a little. Leave the other
_logger.debug("Command #{} args: {} stdout: {} stderr{}".format(tmp_id, cp.args, out_path, err_path))
# Add to the global log file. This can help a little. Leave the other
@@
-267,13
+268,7
@@
class Runtime(object):
def close(self):
for key, subp in self.__subprocess.items():
def close(self):
for key, subp in self.__subprocess.items():
- subp.terminate()
- for key, subp in self.__subprocess.items():
- # TODO move timeout to settings
- subp.wait(timeout=60)
- for key, (stdout, stderr) in self.__stdout_stderr.items():
- stdout.close()
- stderr.close()
+ self.subprocess_terminate(key, check_return=False)
# Always try to remove test module but do not perform check on return
# value.
# Always try to remove test module but do not perform check on return
# value.
This page took
0.024901 seconds
and
5
git commands to generate.