From 4e8db2c3be8f3c9a172fb87ad8739493ab3dfbb1 Mon Sep 17 00:00:00 2001 From: Eran Tiktin Date: Sat, 10 Oct 2015 20:17:08 +0300 Subject: [PATCH 1/2] Go back to using node's console.* and std*.write It seems that whatever issues we had with using the original implementation of node for `console.*` calls and for `process.std*.write` on Windows were solved. So I removed the patch. Tested it with cmd, cygwin and used spawn and exec and everything seems to work (except for colors/ansi escape codes, but that didn't work before anyway). --- atom/browser/lib/init.coffee | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/atom/browser/lib/init.coffee b/atom/browser/lib/init.coffee index 9f92d700c73a..67630a1bd6fa 100644 --- a/atom/browser/lib/init.coffee +++ b/atom/browser/lib/init.coffee @@ -18,25 +18,6 @@ require path.resolve(__dirname, '..', '..', 'common', 'lib', 'init') globalPaths = Module.globalPaths globalPaths.push path.resolve(__dirname, '..', 'api', 'lib') -if process.platform is 'win32' - # Redirect node's console to use our own implementations, since node can not - # handle console output when running as GUI program. - consoleLog = (args...) -> - process.log util.format(args...) + "\n" - streamWrite = (chunk, encoding, callback) -> - chunk = chunk.toString(encoding) if Buffer.isBuffer chunk - process.log chunk - callback() if callback - true - console.log = console.error = console.warn = consoleLog - process.stdout.write = process.stderr.write = streamWrite - - # Always returns EOF for stdin stream. - Readable = require('stream').Readable - stdin = new Readable - stdin.push null - process.__defineGetter__ 'stdin', -> stdin - # Don't quit on fatal error. process.on 'uncaughtException', (error) -> # Do nothing if the user has a custom uncaught exception handler. From cb903a09c0cd281f2cb934afe981b7a4f37d8bc3 Mon Sep 17 00:00:00 2001 From: Eran Tiktin Date: Sat, 10 Oct 2015 20:44:22 +0300 Subject: [PATCH 2/2] Block all internal logs when running without `--enable-logging` --- atom/app/atom_main_delegate.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/atom/app/atom_main_delegate.cc b/atom/app/atom_main_delegate.cc index 6ba1b89837c6..639340bcf091 100644 --- a/atom/app/atom_main_delegate.cc +++ b/atom/app/atom_main_delegate.cc @@ -48,8 +48,10 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) { // Only enable logging when --enable-logging is specified. auto command_line = base::CommandLine::ForCurrentProcess(); - if (!command_line->HasSwitch(switches::kEnableLogging)) + if (!command_line->HasSwitch(switches::kEnableLogging)) { settings.logging_dest = logging::LOG_NONE; + logging::SetMinLogLevel(logging::LOG_NUM_SEVERITIES); + } logging::InitLogging(settings);