@xaidenlabs/uso 1.1.39 → 1.1.40
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 +39 -3
package/package.json
CHANGED
package/src/commands/workflow.js
CHANGED
|
@@ -244,9 +244,45 @@ const validator = async (args = []) => {
|
|
|
244
244
|
log.info(`🚀 Spawning visible Administrator terminal for '${targetCmd}'...`);
|
|
245
245
|
log.warn("👉 A new window will appear. Keep it open to run the validator!");
|
|
246
246
|
|
|
247
|
-
//
|
|
248
|
-
//
|
|
249
|
-
|
|
247
|
+
// Robust Launch using EncodedCommand to avoid quoting hell and set CWD correctly
|
|
248
|
+
// 1. Set CWD (Critical: RunAs defaults to System32)
|
|
249
|
+
// 2. Add Exclusions (Critical: Fixes Access Denied on ledger files)
|
|
250
|
+
// 3. Run Validator
|
|
251
|
+
// 4. Pause on Error
|
|
252
|
+
|
|
253
|
+
const cwd = process.cwd();
|
|
254
|
+
const psScript = `
|
|
255
|
+
$ErrorActionPreference = 'Stop';
|
|
256
|
+
try { Set-Location -Path '${cwd}'; } catch { Write-Host "⚠️ Could not set CWD. Keeping default." -ForegroundColor Yellow; }
|
|
257
|
+
|
|
258
|
+
Write-Host "📂 Working Directory: $(Get-Location)" -ForegroundColor Gray;
|
|
259
|
+
|
|
260
|
+
Write-Host "🛡️ Attempting to whitelist folder in Windows Defender..." -ForegroundColor Cyan;
|
|
261
|
+
try {
|
|
262
|
+
Add-MpPreference -ExclusionPath '${cwd}' -ErrorAction SilentlyContinue;
|
|
263
|
+
Add-MpPreference -ExclusionProcess "solana-test-validator" -ErrorAction SilentlyContinue;
|
|
264
|
+
Write-Host "✅ Secured." -ForegroundColor Green;
|
|
265
|
+
} catch {
|
|
266
|
+
Write-Host "⚠️ Could not set exclusions (User might not be Admin?)" -ForegroundColor Yellow;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
Write-Host "🚀 Starting Validator: ${targetCmd}" -ForegroundColor Green;
|
|
270
|
+
|
|
271
|
+
try {
|
|
272
|
+
& ${targetCmd};
|
|
273
|
+
} catch {
|
|
274
|
+
Write-Host "❌ Validator Execution Failed: $_" -ForegroundColor Red;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if ($LASTEXITCODE -ne 0) {
|
|
278
|
+
Write-Host "❌ Validator Crashed (Exit Code: $LASTEXITCODE). Press Enter to exit..." -ForegroundColor Red;
|
|
279
|
+
Read-Host;
|
|
280
|
+
}
|
|
281
|
+
`.replace(/\n/g, ' ').replace(/\s+/g, ' ').trim();
|
|
282
|
+
|
|
283
|
+
const encoded = Buffer.from(psScript, 'utf16le').toString('base64');
|
|
284
|
+
const psCmd = `powershell -Command "Start-Process powershell -ArgumentList '-NoExit', '-EncodedCommand', '${encoded}' -Verb RunAs"`;
|
|
285
|
+
|
|
250
286
|
shell.exec(psCmd);
|
|
251
287
|
|
|
252
288
|
log.success("✅ Validator launch sequence initiated.");
|