diff --git a/jukebox/child-process.js b/jukebox/child-process.js index c600df4..7eb5fad 100644 --- a/jukebox/child-process.js +++ b/jukebox/child-process.js @@ -7,7 +7,7 @@ const { spawn } = require('child_process'); const { EventEmitter } = require('events'); module.exports.ChildProcessEmitter = class ChildProcessEmitter extends EventEmitter { - constructor(command, logger) { + constructor(command, logger, cwd) { super(); var emitter = this; @@ -17,10 +17,14 @@ module.exports.ChildProcessEmitter = class ChildProcessEmitter extends EventEmit this.logger = logger; this.stderrFilters = []; + var options = { + cwd: cwd, + }; + var cmd = command[0], args = command.slice(1); - this.childProcess = spawn(cmd, args); + this.childProcess = spawn(cmd, args, options); this.childProcess.on('error', function(err) { emitter.logger.error("process error", { class: emitter.constructor.name, err: String(err).trim() }); diff --git a/jukebox/media-player.js b/jukebox/media-player.js index 706627b..219c76d 100644 --- a/jukebox/media-player.js +++ b/jukebox/media-player.js @@ -13,7 +13,7 @@ const DEFAULT_UNKNOWN_THROTTLE = 2000; class MediaPlayer extends ChildProcessEmitter { constructor(config, logger) { - super(config.mpg321, logger); + super(config.mpg321, logger, config.media_path); this.config = config;