Skip to content
This repository has been archived by the owner on Nov 14, 2020. It is now read-only.

Commit

Permalink
eval_file() strip #!shebang if present, fixes #15
Browse files Browse the repository at this point in the history
- before 0a4d9eb unbound symbol errors didn't stop evaluation; now they do
  • Loading branch information
alandipert committed Nov 21, 2013
1 parent 0a4d9eb commit 2394187
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions gherkin
Original file line number Diff line number Diff line change
Expand Up @@ -544,10 +544,16 @@ apply_user() {
r="$ret"
}

has_shebangP() { [[ "$(head -1 $1)" =~ ^#! ]]; }

eval_file() {
local f="$1"
local input=$(cat "$f")
lisp_read <<<"(do $input)"
local f="$1" contents
if has_shebangP "$f"; then
contents="$(tail -n+2 "$f")"
else
contents="$(cat "$f")"
fi
lisp_read <<<"(do $contents)"
protect "$r"
lisp_eval "$r"
unprotect
Expand Down

0 comments on commit 2394187

Please sign in to comment.