【问题标题】:Expect command does not see stdout when executing with nodejs?使用 nodejs 执行时,Expect 命令看不到标准输出?
【发布时间】:2020-08-30 13:09:05
【问题描述】:

我用期望命令编写了一个 bash 文件,期望一些输出并根据它执行操作,当我在终端中执行它时它可以工作,但是当我在 nodejs 中使用 exec 执行它时它不起作用。我认为expect看不到我在bash文件中运行的命令的输出

【问题讨论】:

  • 你能发布你在nodejs中使用的代码吗?让它更清晰。

标签: node.js linux


【解决方案1】:

我通常使用 shelljs Package 来通过 nodejs 执行命令或 shell 脚本。

 const shell = require('shelljs')

 shell.exec('./path_to_your_file')

【讨论】:

    猜你喜欢
    • 2016-01-16
    • 1970-01-01
    • 2014-02-02
    • 2010-09-13
    • 1970-01-01
    • 2011-02-02
    • 2012-10-27
    • 1970-01-01
    • 2012-12-21
    相关资源
    最近更新 更多