1

我的 iisnode 在 win8/IIS8 上运行顺畅。我创建了一个非常简单的 hello world,效果很好。但是,当我尝试使用 process.stdin 时,出现以下错误:

Application has thrown an uncaught exception and is terminated:
Error: Implement me. Unknown stdin file type!
    at process.startup.processStdio.process.openStdin [as stdin] (node.js:405:17)
    at Object.<anonymous> (C:\ApprendaPlatform\SiteData\developer\v1\root\shim\node_modules\actionhero\bin\zzz.js:7:20)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Object.<anonymous> (C:\Program Files\iisnode\interceptor.js:210:1)
    at Module._compile (module.js:449:26)

请注意,我没有通过 process.stdout 得到这个。

我的代码:

// kaboom!
var breakthings = process.stdin;

// works
// var breakthings = process.stdout;

iisnode 是对标准输入做一些时髦的事情,还是我配置错误?

4

2 回答 2

1

就我而言,由于问题仍然存在,我只是覆盖了 iisnode 文件中 process.stdin 的 getter

var events = require('events');

// Define a custom getter for process.stdin since iisnode still didn't fix the bug
process.__defineGetter__('stdin', function(){
    return new events.EventEmitter();
})

// no kaboom anymore ;)
var breakthings = process.stdin;

希望这有帮助;)

更新(02-06-2016):以更明智和更干净的方式:

var events = require('events');

delete process.stdin;
process.stdin = new events.EventEmitter();

// no kaboom anymore ;)
var breakthings = process.stdin;
于 2016-05-31T10:11:13.677 回答
0

Actionhero 现在可以检查这种事情https://github.com/evantahler/actionhero/commit/465a85fba9800466ab9ca3d5df65a18f7decd830

于 2014-05-10T06:32:39.920 回答