Adding shell command execution on click for shell module
This commit is contained in:
parent
fded39fa81
commit
9b2ac5d521
2 changed files with 50 additions and 3 deletions
|
@ -52,7 +52,17 @@ def execute(
|
|||
raise RuntimeError("{} not found".format(cmd))
|
||||
|
||||
if wait:
|
||||
out, _ = proc.communicate()
|
||||
timeout = 60 # seconds
|
||||
try:
|
||||
out, _ = proc.communicate(timeout=timeout)
|
||||
except subprocess.TimeoutExpired as e:
|
||||
logging.warning(f'''
|
||||
Communication with process pid={proc.pid} hangs for more
|
||||
than {timeout} seconds.
|
||||
If this is not expected, the process is stale, or
|
||||
you might have run in stdout / stderr deadlock.
|
||||
''')
|
||||
out, _ = proc.communicate()
|
||||
if proc.returncode != 0:
|
||||
err = "{} exited with code {}".format(cmd, proc.returncode)
|
||||
logging.warning(err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue