iisnode:未知的标准输入文件类型 [英] iisnode: Unknown stdin file type

查看:29
本文介绍了iisnode:未知的标准输入文件类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have iisnode working smoothly on win8/IIS8. I created a very simple hello world and it works great. However, when I try to use process.stdin I get the following error:

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 得到这个.

Note that I do not get this with process.stdout.

我的代码:

// kaboom!
var breakthings = process.stdin;

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

iisnode 是否对标准输入做了一些奇怪的事情,还是我配置错误?

Is iisnode doing something funky to stdin, or have I misconfigured something?

推荐答案

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

In my case, and since the issue still occurs, I just override the getter from the process.stdin in the iisnode file

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):以更明智和更干净的方式:

UPDATE (02-06-2016): In a more advisable and clean way:

var events = require('events');

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

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

这篇关于iisnode:未知的标准输入文件类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆