node tty ReadStream _handle为null

时间:2015-11-11 01:41:01

标签: node.js stream tty electron testem

我正在尝试为测试跑步者Electron编写testem启动器。 Testem向终端打印每个发射器的测试结果(执行测试的分叉进程,传统的浏览器,但在这种情况下是Electron)。 Testem希望将tty设置为“原始模式”,以便它可以创建一个看似实时更新的虚假选项卡视图,并让用户在选项卡之间导航以查看来自不同发射器的结果。 在testem尝试调用process.stdin.setRawMode后,我在终端中看到此错误(在OS X Yosimite上的节点v4.0.0上):

TypeError: Cannot read property 'setRawMode' of null
    at ReadStream.setRawMode (tty.js:49:15)
    at module.exports.View.extend.setRawMode (/Users/beane/Code/yeti-desktop/node_modules/testem/lib/dev/ui/appview.js:255:21)
    at module.exports.View.extend.cleanup (/Users/beane/Code/yeti-desktop/node_modules/testem/lib/dev/ui/appview.js:265:10)
    at EventEmitter.App.cleanupView (/Users/beane/Code/yeti-desktop/node_modules/testem/lib/dev/index.js:254:15)
    at /Users/beane/Code/yeti-desktop/node_modules/testem/lib/dev/index.js:230:14
    at /Users/beane/Code/yeti-desktop/node_modules/testem/lib/dev/index.js:325:23
    at Object.HookRunner.run (/Users/beane/Code/yeti-desktop/node_modules/testem/lib/hook_runner.js:13:14)
    at EventEmitter.App.runHook (/Users/beane/Code/yeti-desktop/node_modules/testem/lib/dev/index.js:322:12)
    at EventEmitter.App.runExitHook (/Users/beane/Code/yeti-desktop/node_modules/testem/lib/dev/index.js:312:10)
    at /Users/beane/Code/yeti-desktop/node_modules/testem/lib/dev/index.js:229:12
    at /Users/beane/Code/yeti-desktop/node_modules/testem/node_modules/async/lib/async.js:52:16
    at Object.async.forEachOf.async.eachOf (/Users/beane/Code/yeti-desktop/node_modules/testem/node_modules/async/lib/async.js:236:30)
    at Object.async.forEach.async.each (/Users/beane/Code/yeti-desktop/node_modules/testem/node_modules/async/lib/async.js:209:22)
    at EventEmitter.App.cleanUpLaunchers (/Users/beane/Code/yeti-desktop/node_modules/testem/lib/dev/index.js:365:11)
    at EventEmitter.App.quit (/Users/beane/Code/yeti-desktop/node_modules/testem/lib/dev/index.js:228:10)
    at process.App.quiteGracefully (/Users/beane/Code/yeti-desktop/node_modules/testem/lib/dev/index.js:43:10)

堆栈跟踪从tty.js:49 from node core开始。这是抛出错误的函数:

ReadStream.prototype.setRawMode = function(flag) {
  flag = !!flag;
  this._handle.setRawMode(flag);
  this.isRaw = flag;
};

我似乎无法弄明白的是this._handle是什么。 Testem并不期望它是null,但出于某种原因它是。任何人都可以帮我解决这个问题吗?

0 个答案:

没有答案