如何从Hubot执行Shell脚本

use*_*414 3 linux bash shell coffeescript hubot

我启动并运行了第一个hubot,并根据现有示例编写了前几个脚本。我想与hubot集成的现有工作流程实质上是基于几个shell脚本,每个脚本执行一项任务。该任务可能相对复杂(git / svn签出,使用gcc编译代码并运行它)。如何使用Hubot执行bash脚本?我看到了这个问题,但是它只解决诸如的简单命令ls。我试过了

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

没有任何运气:

Hubot> execvp(): Permission denied
Run Code Online (Sandbox Code Playgroud)

我检查了明显的内容(-rwxr-xr-x权限),并export HUBOT_LOG_LEVEL="debug"。我与拥有bash脚本的同一用户一起运行hubot。谢谢。

use*_*414 5

供参考:答案是

build = spawn '/bin/bash', ['test.sh']
Run Code Online (Sandbox Code Playgroud)

大啊


cod*_*ion 5

npm install hubot-script-shellcmd
Run Code Online (Sandbox Code Playgroud)

是你通往 shell 的门户。