Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb4e872990 | ||
|
|
e3893f594e | ||
|
|
2457617bdc |
+4
-2
@@ -7,12 +7,14 @@ import path from "node:path"
|
||||
import strftime from 'strftime'
|
||||
import { spawnSync } from "node:child_process"
|
||||
|
||||
const logfd = fs.openSync('/etc/snapback/log.txt', 'w')
|
||||
|
||||
function logToFile() {
|
||||
// Source - https://stackoverflow.com/a/35542360
|
||||
// Posted by Anatol - user3173842
|
||||
// Retrieved 2026-01-14, License - CC BY-SA 3.0
|
||||
|
||||
var access = fs.createWriteStream('/etc/snapback/log.txt');
|
||||
var access = fs.createWriteStream('',{'fd':logfd});
|
||||
process.stdout.write = process.stderr.write = access.write.bind(access);
|
||||
|
||||
process.on('uncaughtException', function (err) {
|
||||
@@ -24,7 +26,7 @@ let config: { [key: string]: string } = {}
|
||||
let index: { [key: string]: { [key: string]: string } } = {}
|
||||
|
||||
function sugoiSpawn(...command: string[]) {
|
||||
const result = spawnSync(command.shift()!, command, { stdio: 'inherit' })
|
||||
const result = spawnSync(command.shift()!, command, { stdio: ['ignore',logfd,logfd] })
|
||||
if (result.error) throw result.error
|
||||
if (result.status !== 0) process.exit(result.status)
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user