From 7828d7fd7a4ccfc7ba41765131ac82bccd2e43bb Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Mon, 14 May 2018 03:12:36 -0400 Subject: [PATCH] Minor clean up --- main.go | 3 ++- main.ts | 3 --- util.ts | 4 +++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index fe3ca39344..71f296591b 100644 --- a/main.go +++ b/main.go @@ -60,6 +60,7 @@ func main() { } err = worker.SendBytes(out) if err != nil { - panic(err) + os.Stderr.WriteString(err.Error()) + os.Exit(1) } } diff --git a/main.ts b/main.ts index eeba4702f0..91be0c4553 100644 --- a/main.ts +++ b/main.ts @@ -20,7 +20,6 @@ function readFileSync(filename: string): string { } function load(argv: string[]): void { - console.log("Load argv", argv); const inputFn = argv[1]; const source = readFileSync(inputFn); console.log("source", source); @@ -37,5 +36,3 @@ V8Worker2.recv((ab: ArrayBuffer) => { break; } }); - -V8Worker2.print("Hello"); diff --git a/util.ts b/util.ts index 99fe798f46..7d0acfce79 100644 --- a/util.ts +++ b/util.ts @@ -8,6 +8,8 @@ const globalEval = eval; // A reference to the global object. const _global = globalEval("this"); +const print = V8Worker2.print; + _global["console"] = { // tslint:disable-next-line:no-any log(...args: any[]): void { @@ -19,6 +21,6 @@ _global["console"] = { out.push(JSON.stringify(a)); } } - V8Worker2.print(out.join(" ")); + print(out.join(" ")); } };