Fix SpawnHelper: rename pipeName param to portStr, fix taskName
pipeName[^8..] crashed for 5-char port strings (e.g. "54321"). Now uses port number directly as task name suffix. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -160,7 +160,7 @@ public class RtcService
|
||||
AgentWorker.Log("RDP: Frame-Loop beendet");
|
||||
}
|
||||
|
||||
private static bool SpawnCaptureHelper(string exePath, string pipeName)
|
||||
private static bool SpawnCaptureHelper(string exePath, string portStr)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -171,7 +171,7 @@ public class RtcService
|
||||
return false;
|
||||
}
|
||||
|
||||
var taskName = $"ITNexus-RDP-{pipeName[^8..]}";
|
||||
var taskName = $"ITNexus-RDP-{portStr}";
|
||||
|
||||
Process.Start(new ProcessStartInfo("schtasks.exe", $"/delete /tn \"{taskName}\" /f")
|
||||
{ CreateNoWindow = true })?.WaitForExit();
|
||||
@@ -181,7 +181,7 @@ public class RtcService
|
||||
? "/ru \"INTERACTIVE\""
|
||||
: $"/ru \"{fullUser}\"";
|
||||
|
||||
var args = $"/create /tn \"{taskName}\" /tr \"\\\"{exePath}\\\" --rdp-capture {pipeName}\" " +
|
||||
var args = $"/create /tn \"{taskName}\" /tr \"\\\"{exePath}\\\" --rdp-capture {portStr}\" " +
|
||||
$"/sc ONCE /st {triggerTime} {ruArg} /it /f";
|
||||
|
||||
var p = Process.Start(new ProcessStartInfo("schtasks.exe", args)
|
||||
|
||||
Reference in New Issue
Block a user