forked from cesium-ml/cesium_web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Silently execute dependency monitoring tools (unless they fail)
Before, we'd dump the output to /dev/null. Unfortunately, when things go wrong the user gets no feedback. Now, we monitor the process, and if it fails dumps stdout and stderr. Also a minor fix to the Python dependency monitor: a regexp that can handle packages with '-' in the name.
- Loading branch information
Showing
4 changed files
with
54 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env python | ||
|
||
import subprocess | ||
import sys | ||
import shlex | ||
|
||
if len(sys.argv) < 2: | ||
print('Usage: silent_monitor.py <cmd to execute>') | ||
sys.exit() | ||
|
||
cmd = ' '.join(sys.argv[1:]) | ||
|
||
tag = 'Silently executing: {}'.format(cmd) | ||
print('[·] {}'.format(tag), end='') | ||
sys.stdout.flush() | ||
|
||
p = subprocess.Popen(shlex.split(cmd), | ||
stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
|
||
err = p.wait() | ||
stdout, stderr = p.stderr.read().strip(), p.stdout.read().strip() | ||
|
||
if err == 0: | ||
print('\r[✓] {}'.format(tag)) | ||
else: | ||
print('\r[✗] {}'.format(tag)) | ||
print('\n! Failure (exit code {}).'.format(err, cmd)) | ||
|
||
if stdout: | ||
print('--- stdout ---') | ||
print(stdout.decode('utf-8')) | ||
|
||
if stderr: | ||
print('--- stderr ---') | ||
print(stderr.decode('utf-8')) | ||
|
||
if stdout or stderr: | ||
print('--- end ---') | ||
|
||
sys.exit(err) | ||
|