[Git][NTPsec/ntpsec][master] Improve failure reporting.

Gary E. Miller gitlab at mg.gitlab.com
Wed Aug 31 21:45:43 UTC 2016


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
09866597 by Gary E. Miller at 2016-08-31T14:35:17-07:00
Improve failure reporting.

- - - - -


1 changed file:

- contrib/smartctl-temp-log


Changes:

=====================================
contrib/smartctl-temp-log
=====================================
--- a/contrib/smartctl-temp-log
+++ b/contrib/smartctl-temp-log
@@ -45,9 +45,13 @@ if 1 < len(sys.argv):
 
 try:
     output = subprocess.check_output(["smartctl", "-a", device], \
+        stderr=subprocess.STDOUT, \
         universal_newlines=True)
-except :
-    sys.stderr.write("ERROR: 'smartctl -a %s' failed\n" % device)
+
+except subprocess.CalledProcessError, e:
+    sys.stderr.write( "ERROR: 'smartctl -a %s' failed\n" % device)
+    sys.stderr.write( e.output )
+    sys.stderr.write( "Return code: %s\n" % e.returncode )
     raise SystemExit(2)
 
 



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/09866597079418243efc97895a49b1e7a2dcd26d
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160831/987b1860/attachment.html>


More information about the vc mailing list