Node.js hubot execute commands on the server

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?

+3
source share
2 answers
process.chdir('/var/folder')

- This is what I was looking for.

+4
source

Not familiar with hubot, but you tried commanding shell commands something like 'cd / var / folder; some-team '

0
source

All Articles