Setup stdin in both processes on Windows
This commit is contained in:
parent
b5e9bb9e6a
commit
28b33074cf
2 changed files with 17 additions and 15 deletions
|
@ -39,14 +39,6 @@ if (process.platform === 'win32') {
|
||||||
}
|
}
|
||||||
console.log = console.error = console.warn = consoleLog
|
console.log = console.error = console.warn = consoleLog
|
||||||
process.stdout.write = process.stderr.write = streamWrite
|
process.stdout.write = process.stderr.write = streamWrite
|
||||||
|
|
||||||
// Always returns EOF for stdin stream.
|
|
||||||
var Readable = require('stream').Readable
|
|
||||||
var stdin = new Readable()
|
|
||||||
stdin.push(null)
|
|
||||||
process.__defineGetter__('stdin', function () {
|
|
||||||
return stdin
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't quit on fatal error.
|
// Don't quit on fatal error.
|
||||||
|
|
|
@ -38,11 +38,21 @@ if (process.type === 'browser') {
|
||||||
global.setInterval = wrapWithActivateUvLoop(timers.setInterval)
|
global.setInterval = wrapWithActivateUvLoop(timers.setInterval)
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're running as a Windows Store app, __dirname will be set
|
if (process.platform === 'win32') {
|
||||||
// to C:/Program Files/WindowsApps.
|
// Always returns EOF for stdin stream.
|
||||||
//
|
const {Readable} = require('stream')
|
||||||
// Nobody else get's to install there, changing the path is forbidden
|
const stdin = new Readable()
|
||||||
// We can therefore say that we're running as appx
|
stdin.push(null)
|
||||||
if (process.platform === 'win32' && __dirname.indexOf('\\Program Files\\WindowsApps\\') === 2) {
|
process.__defineGetter__('stdin', function () {
|
||||||
|
return stdin
|
||||||
|
})
|
||||||
|
|
||||||
|
// If we're running as a Windows Store app, __dirname will be set
|
||||||
|
// to C:/Program Files/WindowsApps.
|
||||||
|
//
|
||||||
|
// Nobody else get's to install there, changing the path is forbidden
|
||||||
|
// We can therefore say that we're running as appx
|
||||||
|
if (__dirname.indexOf('\\Program Files\\WindowsApps\\') === 2) {
|
||||||
process.windowsStore = true
|
process.windowsStore = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue