Skip to content

Instantly share code, notes, and snippets.

Created August 24, 2018 22:09
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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