Fix media player not running in media dir
This commit is contained in:
parent
88fc77f0a5
commit
087a06a20c
@ -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() });
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user