Simple Hubot CoffeeScript to fire other local commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
else | |
msg.send stdout |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment