Skip to content

Commit

Permalink
Merge bebf67d into 70d2a85
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed May 12, 2016
2 parents 70d2a85 + bebf67d commit a3cbe7a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions c2c/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import traceback
import json
import yaml
import subprocess
from yaml.parser import ParserError
from argparse import ArgumentParser
from string import Formatter
Expand Down Expand Up @@ -282,8 +283,11 @@ def read_vars(vars_file):
if "cmd" in interpreter:
cmd = interpreter["cmd"][:] # [:] to clone
cmd.append(expression)
ignore_error = interpreter.get("ignore_error", False)
try:
evaluated = check_output(cmd)
evaluated = check_output(
cmd, stderr=subprocess.PIPE if ignore_error else None
)
except OSError as e: # pragma: nocover
print("ERROR when running the expression '%r': %s" % (
expression, e
Expand All @@ -293,10 +297,10 @@ def read_vars(vars_file):
error = "ERROR when running the expression '%r': %s" % (
expression, e
)
print(error)
if interpreter.get("ignore_error", False):
if ignore_error:
evaluated = error
else:
print(error)
exit(1)

elif interpreter["name"] == "python":
Expand Down

0 comments on commit a3cbe7a

Please sign in to comment.