Skip to content

Instantly share code, notes, and snippets.

@taboularasa
Forked from nbqx/cmd.coffee
Created August 29, 2013 04:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taboularasa/6374282 to your computer and use it in GitHub Desktop.
Save taboularasa/6374282 to your computer and use it in GitHub Desktop.
# hubot-scripts test
# usage:
# hubot cmd ls -la
#
fs = require('fs')
spawn = require('child_process').spawn
module.exports = (robot) ->
robot.respond /(cmd) (.*) (.*)/i, (msg) ->
cmd = msg.match[2]
arg = msg.match[3]
doing = spawn cmd, arg.split ' '
doing.stdout.on 'data', (data) ->
msg.send data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment