This commit is contained in:
@@ -5,7 +5,7 @@ using Microsoft.Extensions.Logging;
|
|||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace AyaNova.Biz
|
namespace AyaNova.Biz
|
||||||
{
|
{
|
||||||
@@ -76,6 +76,20 @@ namespace AyaNova.Biz
|
|||||||
if (!string.IsNullOrWhiteSpace(ServerBootConfig.AYANOVA_BACKUP_PG_DUMP_PATH))
|
if (!string.IsNullOrWhiteSpace(ServerBootConfig.AYANOVA_BACKUP_PG_DUMP_PATH))
|
||||||
BackupUtilityCommand = Path.Combine(ServerBootConfig.AYANOVA_BACKUP_PG_DUMP_PATH, BackupUtilityCommand);
|
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 Arguments = $"{DBNameParameter} -Fc > {DataBackupFile}";
|
||||||
|
|
||||||
var Result = RunProgram.Run(BackupUtilityCommand, Arguments, log, MAXIMUM_MS_ALLOWED_FOR_PROCESSING);
|
var Result = RunProgram.Run(BackupUtilityCommand, Arguments, log, MAXIMUM_MS_ALLOWED_FOR_PROCESSING);
|
||||||
|
|||||||
@@ -52,8 +52,6 @@ namespace AyaNova.Util
|
|||||||
// var FullRunCommand=$"/C {BackupUtilityCommand} {Arguments}";
|
// var FullRunCommand=$"/C {BackupUtilityCommand} {Arguments}";
|
||||||
|
|
||||||
//for Windows need to pass to cmd.exe because often have command line piping etc
|
//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}";
|
var args = $"/C {cmd} {arguments}";
|
||||||
using (var process = new Process())
|
using (var process = new Process())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user