node.js child_process.spawn ENOENT错误 - 仅在supervisord下

时间:2014-06-30 17:51:57

标签: node.js pipe spawn supervisord

我正在使用child_process.spawn运行Node.js命令:

#!/usr/bin/js

var spawn = require("child_process").spawn;

var stockfish = spawn("stockfish");

使用命令行中的$js spawntest.js可以正常工作;它只是像你期望的那样挂起,因为子命令正在等待输入。

但是,当我将此脚本设置为supervisord程序时,它会失败:

$ sudo supervisorctl start spawntest
spawntest: ERROR (abnormal termination)

以下是主管在/ var / log / supervisor / spawntest-stderr --- supervisor-RyULL0.log中保存的stderror输出日志的内容:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn ENOENT
    at errnoException (child_process.js:980:11)
    at Process.ChildProcess._handle.onexit (child_process.js:771:34)

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn ENOENT
    at errnoException (child_process.js:980:11)
    at Process.ChildProcess._handle.onexit (child_process.js:771:34)

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn ENOENT
    at errnoException (child_process.js:980:11)
    at Process.ChildProcess._handle.onexit (child_process.js:771:34)

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn ENOENT
    at errnoException (child_process.js:980:11)
    at Process.ChildProcess._handle.onexit (child_process.js:771:34)

supervisorctl程序配置如下:

[program:spawntest]
command=/home/gus/dev/spawntest.js
autostart=false
autorestart=false
user=gus

为什么这只在主管下失败?是否有任何Node.js模块/全局变量等我可以用来看看直接调用脚本和通过Supervisor之间的区别是什么?

0 个答案:

没有答案