Put main block in the try ... else block
@@ -242,6 +242,7 @@ def communicate(cmd, code=None, output_stream=STREAM_STDOUT, env=None, cwd=None,
stderr=subprocess.PIPE if output_stream & STREAM_STDERR else None,
startupinfo=create_startupinfo()
)
+
except Exception as err:
try:
augmented_env = dict(ChainMap(*env.maps[0:-1]))
@@ -256,6 +257,7 @@ def communicate(cmd, code=None, output_stream=STREAM_STDOUT, env=None, cwd=None,
return ''
+ else:
if logger.isEnabledFor(logging.INFO):
logger.info(make_nice_log_message(
'Running ...', cmd, uses_stdin, cwd, view, None))
