fix: t-001 a t-005 correctif

This commit is contained in:
2026-03-17 15:33:36 +01:00
parent 13457ceb5a
commit bdb65a09ff
6 changed files with 46 additions and 29 deletions

View File

@@ -1,4 +1,4 @@
import { execFile } from "node:child_process"
import {execFile} from "node:child_process"
import {process} from "std-env";
import folderMap from "#server/config/backup-folders.json";
@@ -10,11 +10,14 @@ export const FOLDER_MAP = folderMap as Record<string, string>
export const shellQuote = (value: string) => `'${value.replace(/'/g, `'\\''`)}'`
export function runSsh(command: string): Promise<string> {
if (!REMOTE_HOST) {
return Promise.reject(new Error("BACKUPS_REMOTE_HOST is not configured"))
}
return new Promise((resolve, reject) => {
execFile(
"ssh",
["-o", "BatchMode=yes", "-o", "ConnectTimeout=5", REMOTE_HOST, command],
{ maxBuffer: 10 * 1024 * 1024 },
{maxBuffer: 10 * 1024 * 1024},
(error, stdout, stderr) => {
if (error) {
reject(stderr || error.message)