diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2014-01-30 15:00:17 +0000 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2014-01-30 15:00:17 +0000 |
commit | d12048b792fae19cee1fa8e8b652e1a2c0ac735b (patch) | |
tree | 6baa9845f0d4bfdeca9ac40207d444dd91a462ea | |
parent | 5e0b76d22be2d114bcd3d853ee79c74f25fad806 (diff) | |
download | lorry-controller-d12048b792fae19cee1fa8e8b652e1a2c0ac735b.tar.gz |
Swap ' and " shell quoting to be safer against changes
With "" as the outer quotes, an accidental shell magic character
may ruin everything for everybody. With '' as the outer quotes,
that is much harder to achieve.
Suggested-by: Richard Maw
-rw-r--r-- | yarns.webapp/900-implementations.yarn | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/yarns.webapp/900-implementations.yarn b/yarns.webapp/900-implementations.yarn index 6886adc..fd93123 100644 --- a/yarns.webapp/900-implementations.yarn +++ b/yarns.webapp/900-implementations.yarn @@ -104,16 +104,16 @@ value is expresssed as a JSON value in the step. IMPLEMENTS THEN response has (\S+) set to (.+) cat "$DATADIR/response.body" - python -c " + python -c ' import json, os, sys data = json.load(sys.stdin) - key = os.environ['MATCH_1'] - expected = json.loads(os.environ['MATCH_2']) + key = os.environ["MATCH_1"] + expected = json.loads(os.environ["MATCH_2"]) value = data[key] if value != expected: sys.stderr.write( - 'Key {key} has value {value}, but ' - '{expected} was expected'.format( + "Key {key} has value {value}, but " + "{expected} was expected".format ( key=key, value=value, expected=expected)) sys.exit(1) - " < "$DATADIR/response.body" + ' < "$DATADIR/response.body" |