Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute shell script from hubot

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.

like image 851
user2148414 Avatar asked Dec 25 '22 17:12

user2148414


1 Answers

For reference: the answer was

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

Dah

like image 69
user2148414 Avatar answered Jan 02 '23 15:01

user2148414