I've been struggling with this errors for 2 days and can't realize why electron renderer process.stdin
fails in windows os.
How to reproduce:
type npm install devtool -g
then type devtool
inside the console type process.stdin
and there will be an error message will be two errors, one at line 127 and the other at line 128 at C:\Users\rafael\AppData\Roaming\npm\node_modules\devtool\node_modules\electron-prebuilt\dist\resources\atom.asar\renderer\lib\init.js(devtool update 2.x)
Error: Implement me. Unknown stdin file type!
C:\Users\rafael\AppData\Roaming\npm\node_modules\devtool\node_modules\electron-prebuilt\dist\resour…:127 Error: Implement me. Unknown stdin file type!(…)(anonymous function) @ C:\Users\rafael\AppData\Roaming\npm\node_modules\devtool\node_modules\electron-prebuilt\dist\resour…:127Module._compile @ module.js:425Module._extensions..js @ module.js:432Module.load @ module.js:356Module._load @ module.js:313Module.runMain @ module.js:457startup @ node.js:151(anonymous function) @ node.js:1007 C:\Users\rafael\AppData\Roaming\npm\node_modules\devtool\node_modules\electron-prebuilt\dist\resour…:128 Error: Implement me. Unknown stdin file type! at process.stdin (node.js:747) at hookProcess (C:\Users\rafael\AppData\Roaming\npm\node_modules\devtool\lib\preload.js:117) at C:\Users\rafael\AppData\Roaming\npm\node_modules\devtool\lib\preload.js:29 at Object.<anonymous> (C:\Users\rafael\AppData\Roaming\npm\node_modules\devtool\lib\preload.js:129) at Module._compile (module.js:425) at Object.Module._extensions..js (module.js:432) at Module.load (module.js:356) at Function.Module._load (module.js:313) at Module.require (module.js:366) at require (module.js:385)(anonymous function) @ C:\Users\rafael\AppData\Roaming\npm\node_modules\devtool\node_modules\electron-prebuilt\dist\resour…:128Module._compile @ module.js:425Module._extensions..js @ module.js:432Module.load @ module.js:356Module._load @ module.js:313Module.runMain @ module.js:457startup @ node.js:151(anonymous function) @ node.js:1007
3 Answers
Answers 1
I encountered the same problem.
First I thought that devtool as REPL does not need stdin and was a simple bug in windows build. GitHub repo owners fix it just ignoring stdin on startup but, as you had discovered, devtool is broken and you can not do anything with stdin in windows.
As a proof of concept I create a simple example beyond devtool REPL:
This piece of code does not work.
//test.js var readline = require('readline'); var rl = readline.createInterface({ input: process.stdin, output: process.stdout, terminal: true }); rl.on('line', function(line){ console.log(line); })
devtool test.js < input.txt
Error: Implement me. Unknown stdin file type!
Windows 7 x64, S.O. Admin rights, Node v5.10.0, npm v3.8.3 DevTool v1.9.1.
I had left a comment in your github issue but is closed so I opened a new one.
Answers 2
There is another question pointing to the same problem. One of the comments states that it's a known iisnode
issue and also suggests a work around by wrapping all calls to process.stdin
like:
if(!process.env.IISNODE_VERSION) { // do stuff with process.stdin }
It can be a temporary solution. I'm sure you've already taken a look to that post, what do you think?
Answers 3
Reading through the libuv source code which is what nodejs uses for certain low-level operations, seems that the reason is that the type of buffer or handle cannot be determined specifically for windows. The GetFileType
function seems to return an unknown handle.
This is definitely a windows only issue because the part of the library that determines the type of handle is within src/win/handle.c
of the UV source code so I don't think this affects *NIX OS'es indeed.
Maybe the installed nodejs version is missing a build-time option?
0 comments:
Post a Comment