-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hubot sends output to the wrong channel #326
Comments
Conversation in #dev starts here: https://open.rocket.chat/channel/dev?msg=rdNWhBrb8AeD8F5QC But basically cloning the message inside the respond is a workaround |
This code would fix the problem:
|
since msg has a TON of functions in it, this is better:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description:
Situation: a hubot script that runs for longer time may send output to the wrong channel
Steps to reproduce:
create a hubot script like this:
` module.exports = (robot) => {
robot.respond(/(some_long_process)/i, (msg) => {
const { spawn } = require('child_process');
const cmd = "some_long_process.sh";
const args = msg.match['input'].split(" ");
const child = spawn(cmd, args);
child.stdout.on('data', function(data) {
outputArr = data.toString().split("\n");
for (var i = 0; i < outputArr.length; i++) {
if (outputArr[i].length > 1)
{ msg.send(outputArr[i]);}
}
});`
invoke that script in channel 1
while it is running and sending output to channel 1, change to channel 2
type something in channel 2 BEFORE the hubot script finishes running
The output generated by hubot will not start appearing in channel 2.
if you omit step 4, the output will go where it belongs, in channel 1.
Expected behavior:
output should always go to channel 1
Server Setup Information:
The text was updated successfully, but these errors were encountered: