How to execute shell script from hubot

4.2k views Asked by At

I got my first hubot up and running, and wrote my first few scripts based on the existing examples. My existing workflow, which I would like to integrate with hubot, is essentially based on several shell scripts, each one of them performing one task. The task can be relatively complex (git/svn checkout, compiling code with gcc, and running it). How can I execute a bash script with hubot? I have seen this question, but it only addresses simple commands such as ls. I tried

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

without any luck:

Hubot> execvp(): Permission denied

I checked the obvious things (-rwxr-xr-x permissions), and export HUBOT_LOG_LEVEL="debug". I am running hubot with the same user that owns the bash scripts. Thanks.

2

There are 2 answers

0
user2148414 On BEST ANSWER

For reference: the answer was

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

Dah

0
coderofsalvation On
npm install hubot-script-shellcmd

is your doorway to the shell.