3 Commits
Author SHA1 Message Date
sugoidogo fb4e872990 fix output piping
Main / release (push) Successful in 42s
2026-01-14 00:30:11 -08:00
sugoidogo e3893f594e fix subcommand output
Main / release (push) Successful in 42s
2026-01-14 00:21:48 -08:00
sugoidogo 2457617bdc redirect subcommand output to file
Main / release (push) Successful in 41s
2026-01-14 00:17:04 -08:00
+4 -2
View File
@@ -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