Call process.log from fallback stream on Windows
(cherry picked from commit d31e629b4f2daf3500a485caab2b2990a41e3ad4)
This commit is contained in:
Родитель
ef843c373f
Коммит
85d3f5488e
|
@ -153,11 +153,16 @@ function setupStdio() {
|
|||
};
|
||||
}
|
||||
|
||||
function createDevNull() {
|
||||
function createFallbackStream() {
|
||||
var Writable = process.NativeModule.require('stream').Writable;
|
||||
var stream = new Writable;
|
||||
stream.isTTY = false;
|
||||
stream._write = function(chunk, encoding, callback) {
|
||||
if (process.platform === 'win32' &&
|
||||
process.env.ELECTRON_RUN_AS_NODE &&
|
||||
!process.env.ELECTRON_NO_ATTACH_CONSOLE) {
|
||||
process.log(chunk.toString());
|
||||
}
|
||||
process.nextTick(callback);
|
||||
};
|
||||
return stream;
|
||||
|
@ -201,7 +206,7 @@ function createWritableStdioStream(fd) {
|
|||
// Ignore stream errors.
|
||||
stream.on('error', function() {});
|
||||
} catch (error) {
|
||||
stream = createDevNull();
|
||||
stream = createFallbackStream();
|
||||
}
|
||||
|
||||
// For supporting legacy API we put the FD here.
|
||||
|
|
Загрузка…
Ссылка в новой задаче