Skip to content

Commit

Permalink
Yet some changes. See changelog for details
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonle committed Jul 28, 2021
1 parent 4fc8755 commit 738f697
Show file tree
Hide file tree
Showing 8 changed files with 1,145 additions and 866 deletions.
12 changes: 11 additions & 1 deletion cli/compatibleFormat.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
[
".mp3", ".ogg", ".opus", ".aac", ".m4a", ".wav", ".flac", ".ape", ".wv", ".oga", ".webm"
".mp3",
".ogg",
".opus",
".aac",
".m4a",
".wav",
".flac",
".ape",
".wv",
".oga",
".webm"
]
58 changes: 30 additions & 28 deletions cli/daemon.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
// https://wiki.unix7.org/node/daemon-sample
var child_process = require('child_process');
var { writeFileSync } = require('fs');
var child_process = require("child_process");
var { writeFileSync } = require("fs");

function child(exe, args, env) {
var child = child_process.spawn(exe, args, {
detached: true,
stdio: ['ignore', 'ignore', 'ignore'],
env: env
})
child.unref()
return child
}

module.exports = function(nodeBin) {
console.log('Daemon PID :', process.pid);
console.log('Daemon PPID:', process.ppid);
console.log(`\nTo kill server, Run \"openradio-pulse -k\"`);
writeFileSync(process.env.TMPDIR + "/openradio-pulse-daemon.json", JSON.stringify({ pid: process.pid, ppid: process.ppid }));

if (process.env.__daemon) {
return process.pid
}
process.env.__daemon = true

var args = [].concat(process.argv)
var node = args.shift()
var env = process.env
child(node, args, env)
return process.exit()
var child = child_process.spawn(exe, args, {
detached: true,
stdio: ["ignore", "ignore", "ignore"],
env: env,
});
child.unref();
return child;
}

module.exports = function (nodeBin) {
console.log("Daemon PID :", process.pid);
console.log(`\nTo kill server, Run \"openradio-pulse -k\"`);
writeFileSync(
process.env.TMPDIR + "/openradio-pulse-daemon.json",
JSON.stringify({ pid: process.pid })
);

if (process.env.__daemon) {
return process.pid;
}
process.env.__daemon = true;

var args = [].concat(process.argv);
var node = args.shift();
var env = process.env;
child(node, args, env);
return process.exit();
};
Loading

0 comments on commit 738f697

Please sign in to comment.