diff --git a/atom/browser/lib/init.coffee b/atom/browser/lib/init.coffee index 2b6b1bb3c2..9f92d700c7 100644 --- a/atom/browser/lib/init.coffee +++ b/atom/browser/lib/init.coffee @@ -21,10 +21,15 @@ 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. - print = (args...) -> + consoleLog = (args...) -> process.log util.format(args...) + "\n" - console.log = console.error = console.warn = print - process.stdout.write = process.stderr.write = print + 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