【问题标题】:How to execute shell script from hubot如何从hubot执行shell脚本
【发布时间】:2013-12-17 19:36:55
【问题描述】:

我启动并运行了我的第一个 hubot,并根据现有示例编写了我的前几个脚本。我想与hubot集成的现有工作流程基本上基于几个shell脚本,每个脚本都执行一项任务。该任务可能相对复杂(git/svn checkout,使用 gcc 编译代码并运行它)。如何使用 hubot 执行 bash 脚本?我见过this question,但它只处理简单的命令,例如ls。我试过了

build = spawn 'source', ['test.sh']
build.stdout.on 'data', (data) -> msg.send data.toString()
build.stderr.on 'data', (data) -> msg.send data.toString()

运气不好:

Hubot> execvp(): Permission denied

我检查了明显的东西(-rwxr-xr-x 权限)和export HUBOT_LOG_LEVEL="debug"。 我正在使用拥有 bash 脚本的同一用户运行 hubot。 谢谢。

【问题讨论】:

  • 给出test.sh的完整路径?
  • 我都试过了,但都没有运气:给出test.sh的完整路径并在调用source之前调用process.chdir(scriptDir)

标签: linux bash shell coffeescript hubot


【解决方案1】:

供参考:答案是

build = spawn '/bin/bash', ['test.sh']

【讨论】:

    【解决方案2】:
    npm install hubot-script-shellcmd
    

    是你通往 shell 的大门。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-10-19
      • 1970-01-01
      • 2016-08-14
      • 2013-06-13
      • 1970-01-01
      • 1970-01-01
      • 2020-09-15
      • 2016-07-02
      相关资源
      最近更新 更多