I am trying to execute a command on a server using hubot. This example works for me:
robot.respond /(cmd)/i, (msg) ->
doing = spawn 'ls', ['-la']
doing.stdout.on 'data', (data) ->
msg.send data.toString()
However, I need to change the folder before executing the command that I want to execute. I want hubot to start:
cd /var/folder && some-command
but changing the folder with hubot script does not work.
The executable command has a lot of files downloaded based on the folder in which it is located, so it seems to me that I should go to this folder.
How can I get hubot to execute a command from a specific path?
source
share