From c2cf1badfdf2d88e90e7b0e59bf684bd913627c0 Mon Sep 17 00:00:00 2001 From: Amish Shah Date: Sat, 12 Dec 2015 21:04:30 +0000 Subject: [PATCH] Fixed multiple avconvs/ffmpeg processes still staying alive --- lib/Voice/VoiceConnection.js | 6 ++++-- src/Voice/VoiceConnection.js | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/Voice/VoiceConnection.js b/lib/Voice/VoiceConnection.js index 8f5cf99ed..7d8ac7faa 100644 --- a/lib/Voice/VoiceConnection.js +++ b/lib/Voice/VoiceConnection.js @@ -92,6 +92,8 @@ var VoiceConnection = (function (_EventEmitter) { this.playing = false; this.playingIntent = null; if (this.streamProc) { + this.streamProc.stdin.pause(); + this.streamProc.kill("SIGINT"); this.streamProc.kill(); } if (this.instream) { @@ -129,7 +131,7 @@ var VoiceConnection = (function (_EventEmitter) { if (!self.playingIntent || !self.playing) { self.setSpeaking(false); retStream.emit("end"); - console.log("ending 1"); + //console.log("ending 1"); return; } try { @@ -140,7 +142,7 @@ var VoiceConnection = (function (_EventEmitter) { if (onWarning) { retStream.emit("end"); self.setSpeaking(false); - console.log("ending 2"); + //console.log("ending 2"); return; } else { onWarning = true; diff --git a/src/Voice/VoiceConnection.js b/src/Voice/VoiceConnection.js index 9018a74d8..2b3286f19 100644 --- a/src/Voice/VoiceConnection.js +++ b/src/Voice/VoiceConnection.js @@ -63,6 +63,8 @@ export default class VoiceConnection extends EventEmitter { this.playing = false; this.playingIntent = null; if (this.streamProc) { + this.streamProc.stdin.pause(); + this.streamProc.kill("SIGINT"); this.streamProc.kill(); } if(this.instream){ @@ -99,7 +101,7 @@ export default class VoiceConnection extends EventEmitter { if (!self.playingIntent || !self.playing) { self.setSpeaking(false); retStream.emit("end"); - console.log("ending 1"); + //console.log("ending 1"); return; } try { @@ -110,7 +112,7 @@ export default class VoiceConnection extends EventEmitter { if (onWarning) { retStream.emit("end"); self.setSpeaking(false); - console.log("ending 2"); + //console.log("ending 2"); return; } else { onWarning = true;