summaryrefslogtreecommitdiff
path: root/main.ts
diff options
context:
space:
mode:
Diffstat (limited to 'main.ts')
-rw-r--r--main.ts14
1 files changed, 10 insertions, 4 deletions
diff --git a/main.ts b/main.ts
index 9fe002d7e..ac0b4d329 100644
--- a/main.ts
+++ b/main.ts
@@ -2,10 +2,16 @@ import { main as pb } from "./msg.pb";
import "./util";
import * as runtime from "./runtime";
import * as timers from "./timers";
+import * as util from "./util";
-function start(cwd: string, argv: string[]): void {
- // TODO parse arguments.
- const inputFn = argv[1];
+// To control internal logging output
+// Set with the -debug command-line flag.
+export let debug = false;
+
+function start(cwd: string, argv: string[], debugFlag: boolean): void {
+ debug = debugFlag;
+ util.log("start", { cwd, argv, debugFlag });
+ const inputFn = argv[0];
const mod = runtime.resolveModule(inputFn, cwd + "/");
mod.compileAndRun();
}
@@ -14,7 +20,7 @@ V8Worker2.recv((ab: ArrayBuffer) => {
const msg = pb.Msg.decode(new Uint8Array(ab));
switch (msg.payload) {
case "start":
- start(msg.start.cwd, msg.start.argv);
+ start(msg.start.cwd, msg.start.argv, msg.start.debugFlag);
break;
case "timerReady":
timers.timerReady(msg.timerReady.id, msg.timerReady.done);