sheepit/flamenco toggle

This commit is contained in:
Nathan
2025-12-17 16:46:35 -07:00
parent 0460865ebc
commit 553758c378
7 changed files with 16425 additions and 44 deletions

View File

@@ -1,4 +1,5 @@
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using UnifiedFarmLauncher.Models;
@@ -20,7 +21,7 @@ namespace UnifiedFarmLauncher.Services
await _controllerService.DeployAttachHelperAsync(worker);
var remoteBasePath = await _sshService.GetWorkerBasePathAsync(worker);
var remoteHelper = $"{remoteBasePath.Replace("\\", "/")}/attach-helper.ps1";
var remoteHelper = Path.Combine(remoteBasePath, "attach-helper.ps1");
var paramsBlock = $"-WorkerName \"{worker.Name}\" -WorkerType \"{workerType}\"";
if (commandOnly)
@@ -32,7 +33,9 @@ namespace UnifiedFarmLauncher.Services
paramsBlock += $" -Command \"{command}\"";
}
var remoteCmd = $"powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -File \"{remoteHelper}\" {paramsBlock}";
// Use Windows path format (backslashes) and ensure it's properly quoted
// Add -NoExit to keep window open and ensure output is visible
var remoteCmd = $"powershell.exe -NoLogo -NoProfile -NoExit -ExecutionPolicy Bypass -File \"{remoteHelper}\" {paramsBlock}";
_sshService.StartInteractiveSsh(worker, remoteCmd);
}

View File

@@ -339,12 +339,15 @@ namespace UnifiedFarmLauncher.Services
var sshArgs = BuildSshArgs(parts, true);
sshArgs.Add(command);
var argsString = string.Join(" ", sshArgs.Select(arg => $"\"{arg.Replace("\"", "\\\"")}\""));
var process = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = GetSshExecutable(),
Arguments = string.Join(" ", sshArgs.Select(arg => $"\"{arg.Replace("\"", "\\\"")}\"")),
WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
Arguments = argsString,
UseShellExecute = true,
CreateNoWindow = false
}