Skip to content

Commit

Permalink
Update signal.js
Browse files Browse the repository at this point in the history
  • Loading branch information
xosg committed Feb 19, 2024
1 parent d094d33 commit 3aca0e7
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions signal.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ async function POST(request, response, HTTP) {
case "/exec": {
return new Promise((res, rej) => {

require('child_process').exec(
child_process.exec(
decodeURIComponent(request.headers['exec']),
(error, stdout, stderr) => {
if (error) {
Expand Down Expand Up @@ -310,7 +310,7 @@ async function Signal(request, response, HTTP) {
await global.Boot()
}

await require('fs').promises.writeFile(__dirname + '/signal.json', JSON.stringify(signal, null, '\t'));
await fs.promises.writeFile(__dirname + '/signal.json', JSON.stringify(signal, null, '\t'));

await new Promise(res => {
response.end(JSON.stringify(newSignal), res);
Expand Down Expand Up @@ -343,7 +343,7 @@ async function Write(req, res, HTTP) {
})
})

await require('fs').promises.writeFile(__dirname + decodeURIComponent(req.headers['write']), body)
await fs.promises.writeFile(__dirname + decodeURIComponent(req.headers['write']), body)

return ('updated');

Expand All @@ -353,24 +353,6 @@ async function Write(req, res, HTTP) {



global.restartProcess = function () {
HTTP.closeAllConnections()
HTTP.close(() => {
console.log(1111)
require('child_process').spawn(
process.argv[0],
[process.argv[1], ...process.argv.slice(2)], {
stdio: 'inherit',
detached: true
}).unref();
process.exit();
});
}








Expand Down

0 comments on commit 3aca0e7

Please sign in to comment.