This commit is contained in:
2021-12-15 18:45:21 +00:00
parent db24ea4aa5
commit a23d575f31
2 changed files with 18 additions and 6 deletions

View File

@@ -5,7 +5,7 @@ using Microsoft.Extensions.Logging;
using AyaNova.Models;
using AyaNova.Util;
using System.IO;
using System.Runtime.InteropServices;
namespace AyaNova.Biz
{
@@ -76,6 +76,20 @@ namespace AyaNova.Biz
if (!string.IsNullOrWhiteSpace(ServerBootConfig.AYANOVA_BACKUP_PG_DUMP_PATH))
BackupUtilityCommand = Path.Combine(ServerBootConfig.AYANOVA_BACKUP_PG_DUMP_PATH, BackupUtilityCommand);
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
//put quotes around paths if spaces in them
if (BackupUtilityCommand.Contains(' '))
{
BackupUtilityCommand = $"\"{BackupUtilityCommand}\"";
}
if (DataBackupFile.Contains(' '))
{
DataBackupFile = $"\"{DataBackupFile}\"";
}
}
var Arguments = $"{DBNameParameter} -Fc > {DataBackupFile}";
var Result = RunProgram.Run(BackupUtilityCommand, Arguments, log, MAXIMUM_MS_ALLOWED_FOR_PROCESSING);

View File

@@ -52,8 +52,6 @@ namespace AyaNova.Util
// var FullRunCommand=$"/C {BackupUtilityCommand} {Arguments}";
//for Windows need to pass to cmd.exe because often have command line piping etc
//todo: make this work when there are spaces with quotes etc
var args = $"/C {cmd} {arguments}";
using (var process = new Process())
{