Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js Expect命令在使用nodejs执行时没有看到stdout?_Node.js_Linux - Fatal编程技术网

Node.js Expect命令在使用nodejs执行时没有看到stdout?

Node.js Expect命令在使用nodejs执行时没有看到stdout?,node.js,linux,Node.js,Linux,我用expect命令编写了一个bash文件,它需要一些输出和do操作,当我在终端中执行它时,它可以工作,但当我在nodejs中使用exec执行它时,它就不工作了。我认为我在bash文件中运行的命令的输出不能被我通常使用的expect看到,用于通过nodejs执行命令或shell脚本 const shell = require('shelljs') shell.exec('./path_to_your_file') 你能发布你在nodejs中使用的代码吗?这样就更清楚了。

我用expect命令编写了一个bash文件,它需要一些输出和do操作,当我在终端中执行它时,它可以工作,但当我在nodejs中使用exec执行它时,它就不工作了。我认为我在bash文件中运行的命令的输出不能被我通常使用的expect看到,用于通过nodejs执行命令或shell脚本

 const shell = require('shelljs')

 shell.exec('./path_to_your_file')

你能发布你在nodejs中使用的代码吗?这样就更清楚了。