summaryrefslogtreecommitdiff
path: root/cli/tsc/99_main_compiler.js
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@gmail.com>2021-05-03 01:30:03 +0200
committerGitHub <noreply@github.com>2021-05-02 19:30:03 -0400
commitea917384feb1c800438d13dddac9ee977d2c47fe (patch)
treee3d5069ac4f96713c98519853cfe25e93c32f883 /cli/tsc/99_main_compiler.js
parentc9ac851b9005e5a1e90016e52b3a10dd1f1012b7 (diff)
refactor(core): convert core.print() to a builtin op (#10436)
Diffstat (limited to 'cli/tsc/99_main_compiler.js')
-rw-r--r--cli/tsc/99_main_compiler.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/cli/tsc/99_main_compiler.js b/cli/tsc/99_main_compiler.js
index f944b21b8..b4626374d 100644
--- a/cli/tsc/99_main_compiler.js
+++ b/cli/tsc/99_main_compiler.js
@@ -34,15 +34,16 @@ delete Object.prototype.__proto__;
}
}
+ function printStderr(msg) {
+ core.print(msg, true);
+ }
+
function debug(...args) {
if (logDebug) {
const stringifiedArgs = args.map((arg) =>
typeof arg === "string" ? arg : JSON.stringify(arg)
).join(" ");
- // adding a non-zero integer value to the end of the debug string causes
- // the message to be printed to stderr instead of stdout, which is better
- // aligned to the behaviour of debug messages
- core.print(`DEBUG ${logSource} - ${stringifiedArgs}\n`, 1);
+ printStderr(`DEBUG ${logSource} - ${stringifiedArgs}\n`);
}
}
@@ -52,7 +53,7 @@ delete Object.prototype.__proto__;
? String(arg)
: JSON.stringify(arg)
).join(" ");
- core.print(`ERROR ${logSource} = ${stringifiedArgs}\n`, 1);
+ printStderr(`ERROR ${logSource} = ${stringifiedArgs}\n`);
}
class AssertionError extends Error {