git://git.onelab.eu
/
nodemanager.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2b96d04
)
log subprocess calls.
1.7
1.7
author
Faiyaz Ahmed
<faiyaza@cs.princeton.edu>
Mon, 11 May 2009 15:43:33 +0000
(15:43 +0000)
committer
Faiyaz Ahmed
<faiyaza@cs.princeton.edu>
Mon, 11 May 2009 15:43:33 +0000
(15:43 +0000)
logger.py
patch
|
blob
|
history
diff --git
a/logger.py
b/logger.py
index
3fedde9
..
17ae04c
100644
(file)
--- a/
logger.py
+++ b/
logger.py
@@
-43,7
+43,12
@@
def log(msg,level=LOG_NODE):
def log_call(*args):
log('running command %s' % ' '.join(args))
def log_call(*args):
log('running command %s' % ' '.join(args))
- try: subprocess.check_call(args, close_fds=True)
+ try:
+ child = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
+ child.wait() # wait for proc to hang up
+ if child.returncode:
+ raise Exception("command failed:\n stdout - %s\n stderr - %s" % \
+ (child.stdout.readlines(), child.stderr.readlines()))
except: log_exc()
def log_exc(name = None):
except: log_exc()
def log_exc(name = None):