Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Simple Hubot CoffeeScript to fire other local commands
# Description:
# Runs a command on hubot
# TOTAL VIOLATION of any and all security!
# Commands:
# hubot cmd <command> - runs a command on hubot host
module.exports = (robot) ->
robot.respond /CMD (.*)$/i, (msg) ->
# console.log(msg)
@exec = require('child_process').exec
cmd = msg.match[1]
msg.send "Running [#{cmd}]..."
@exec cmd, (error, stdout, stderr) ->
if error
msg.send error
msg.send stderr
msg.send stdout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.