-
Notifications
You must be signed in to change notification settings - Fork 31
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
err.killed returns undefined #23
Comments
confirmed, same problem here example code: const sfx = require('play-sound')(opts = {player: "aplay"})
var voiceoutput;
voiceoutput = sfx.play('./output.wav', function(err){
if (err) {
console.log('Couldn\'t play: already playing');
if (err.killed) {
console.log('Stopped talking');
}
}
voiceoutput = null;
return
})
function silence() {
if (voiceoutput != null) {
voiceoutput.kill();
} else {
console.log('audio output already stopped');
}
} |
This item can be marked 'solved', all that is required is an update to the example/readme file. replace: var audio = player.play('foo.mp3', function(err){
if (err && !err.killed) throw err
})
audio.kill() with: var audio = player.play('foo.mp3', function(err){
if (err && !audio.killed) throw err
})
audio.kill()
// audio.killed == true in my example above, the code would change to: if (voiceoutput.killed) {
console.log('Stopped talking');
} @Komoszek tagging you in case you still need this on an old project ;) |
Although on second thought, perhaps err should be more than 1, so maybe not 'solved' just yet... |
not working .. with kill() hhm so i use https://www.npmjs.com/package/tree-kill
|
Since version 1.1.2 version you can't check if process was killed because err.killed always returns undefined (err is only a number, not an object).
The text was updated successfully, but these errors were encountered: