attach functional
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,19 +1,26 @@
|
|||||||
|
[CmdletBinding()]
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory = $true)]
|
[Parameter(Mandatory = $true, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $false)]
|
||||||
[string]$WorkerName,
|
[string]$WorkerName,
|
||||||
|
|
||||||
[Parameter(Mandatory = $true)]
|
[Parameter(Mandatory = $true, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $false)]
|
||||||
[string]$WorkerType,
|
[string]$WorkerType,
|
||||||
|
|
||||||
|
[Parameter(ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $false)]
|
||||||
[string]$DataRoot = (Join-Path ([Environment]::GetFolderPath('LocalApplicationData')) 'UnifiedWorkers'),
|
[string]$DataRoot = (Join-Path ([Environment]::GetFolderPath('LocalApplicationData')) 'UnifiedWorkers'),
|
||||||
|
|
||||||
|
[Parameter(ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $false)]
|
||||||
[switch]$CommandOnly,
|
[switch]$CommandOnly,
|
||||||
|
|
||||||
|
[Parameter(ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $false)]
|
||||||
[string]$Command
|
[string]$Command
|
||||||
)
|
)
|
||||||
|
|
||||||
$ErrorActionPreference = 'Continue'
|
$ErrorActionPreference = 'Continue'
|
||||||
|
|
||||||
|
# Explicitly clear any pipeline input to prevent binding errors
|
||||||
|
$null = $input
|
||||||
|
|
||||||
# Ensure we can see output immediately
|
# Ensure we can see output immediately
|
||||||
try {
|
try {
|
||||||
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
||||||
|
|||||||
@@ -35,7 +35,9 @@ namespace UnifiedFarmLauncher.Services
|
|||||||
|
|
||||||
// Use Windows path format (backslashes) and ensure it's properly quoted
|
// Use Windows path format (backslashes) and ensure it's properly quoted
|
||||||
// Add -NoExit to keep window open and ensure output is visible
|
// Add -NoExit to keep window open and ensure output is visible
|
||||||
var remoteCmd = $"powershell.exe -NoLogo -NoProfile -NoExit -ExecutionPolicy Bypass -File \"{remoteHelper}\" {paramsBlock}";
|
// Use -Command with & to properly invoke the script and avoid pipeline input issues
|
||||||
|
var escapedHelper = remoteHelper.Replace("'", "''");
|
||||||
|
var remoteCmd = $"powershell.exe -NoLogo -NoProfile -NoExit -ExecutionPolicy Bypass -Command \"& '{escapedHelper}' {paramsBlock}\"";
|
||||||
|
|
||||||
_sshService.StartInteractiveSsh(worker, remoteCmd);
|
_sshService.StartInteractiveSsh(worker, remoteCmd);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user