[CS2] Don’t require async/await support to run coffee (#4679)

* Get `coffee` command working again in Node 6, by converting the ‘await’ wrapper in the REPL to use a Promise instead of the ‘await’ keyword; add tests for REPL ‘await’ wrapper, including test to skip async tests if the runtime doesn’t support them

* Code review

* Let's support Node 6+ if we can
This commit is contained in:
Geoffrey Booth
2017-09-01 12:19:15 -07:00
committed by GitHub
parent 4a4f752204
commit 671486989f
5 changed files with 30 additions and 9 deletions

View File

@@ -44,9 +44,9 @@ replDefaults =
result = runInContext js, context, filename
# Await an async result, if necessary
if isAsync
result = await result
cb null, result unless sawSIGINT
sawSIGINT = false
result.then (resolvedResult) ->
cb null, resolvedResult unless sawSIGINT
sawSIGINT = no
else
cb null, result
catch err