Coder Social home page Coder Social logo

hubot-scripts's People

Contributors

sapg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hubot-scripts's Issues

Doesnt work with any other commands

When i change command on "echo" or any script - in console i see this:
[Tue Jul 07 2015 06:37:52 GMT+0800 (IRKT)] ERROR TypeError: Cannot read property 'length' of null
at SlackBot.send (/opt/slack/node_modules/hubot-slack/src/slack.coffee:201:7, :243:16)
at Response.send (/opt/slack/node_modules/hubot/src/response.coffee:22:5, :20:47)
at /opt/slack/scripts/shell.coffee:28:7, :11:13
at ChildProcess.exithandler (child_process.js:742:7)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Socket. (child_process.js:1183:11)
at Socket.emit (events.js:107:17)
at Pipe.close (net.js:485:12)

I using slack adapter.
os: debian 7

Broken Pipes Create Inconsistent Return of Stdout

Not sure what my issue is, but I can't get the script to return even a pwd or ls. Here's a few versions I've done with your code:

module.exports = (robot) ->
 robot.respond /pwd(.*)$/i, (msg) ->
    @exec = require('child_process').exec
    command = "pwd"

    msg.send "This is the command #{command}."

    @exec command, (error, stdout, stderr) ->
      msg.send error
      msg.send stdout
      msg.send stderr

This should return the current dir to stdout--any script has to start in SOME directory, right?

ls also returns nothing.

This worked a bit:

module.exports = (robot) ->
 robot.respond /find (.*)$/i, (msg) ->
    Argument = msg.match[1]
    @exec = require('child_process').exec
    command = "locate #{Argument}"

    msg.send "Looking up #{Argument}..."
    msg.send "This is the command #{command}."

    @exec command, (error, stdout, stderr) ->
      msg.send error
      msg.send stdout
      msg.send stderr

When I search for my username, it returns hundreds of lines to the chatroom.

When I search for something else that gives a result in bash, I get nothing. (For example, I searched for both vinyl and vinyl-file because I saw them in my node dir somewhere.

These both returned nothing. I also get nothing when I pipe to grep or head -n.

I get this result when I am using Hubot in a Slack chatroom. I seem to get the expected result when I use the shell adapter to test, but my ultimate goal is to get hubot scripts running in Slack.

Edit: When I run the script in the shell, it gives the following error. This could just be something I don't understand about how child_process works because the pipe is giving me the following output and probably preventing it from writing to Slack:

locate: I/O error while writing to standard output: Broken pipe

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.