fix: t-001 a t-005 correctif
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user