diff options
author | Andy Hayden <andyhayden1@gmail.com> | 2018-11-05 09:55:59 -0800 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-11-05 09:55:59 -0800 |
commit | 27ecfc1617c79d23255e025fcbd0257b3523906a (patch) | |
tree | e6b68b4a291372e0a479d7dff156d546ff965d30 /js/main.ts | |
parent | 5e48a681c4d6d6cb3debb4024b5108780dbbad90 (diff) |
Add repl (#998)
- Running repl from js side.
- Add tests for repl behavior.
- Handle ctrl-C and ctrl-D.
Diffstat (limited to 'js/main.ts')
-rw-r--r-- | js/main.ts | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/js/main.ts b/js/main.ts index 50de2c26c..0ed45aaec 100644 --- a/js/main.ts +++ b/js/main.ts @@ -8,6 +8,7 @@ import { libdeno } from "./libdeno"; import { args } from "./deno"; import { sendSync, handleAsyncMsgFromRust } from "./dispatch"; import { promiseErrorExaminer, promiseRejectHandler } from "./promise_util"; +import { replLoop } from "./repl"; import { version } from "typescript"; function sendStart(): msg.StartRes { @@ -77,13 +78,13 @@ export default function denoMain() { } log("args", args); Object.freeze(args); - const inputFn = args[0]; - if (!inputFn) { - console.log("No input script specified."); - os.exit(1); - } compiler.recompile = startResMsg.recompileFlag(); - compiler.run(inputFn, `${cwd}/`); + + if (inputFn) { + compiler.run(inputFn, `${cwd}/`); + } else { + replLoop(); + } } |