continue sheeping
This commit is contained in:
@@ -30,7 +30,35 @@ if (-not (Test-Path `$exe)) {
|
||||
`$dir = Split-Path `$exe
|
||||
Write-Host "Launching SheepIt at `$exe" -ForegroundColor Cyan
|
||||
`$proc = Start-Process -FilePath `$exe -WorkingDirectory `$dir -WindowStyle Minimized -PassThru
|
||||
Write-Host "SheepIt started (PID: `$($proc.Id))." -ForegroundColor Green
|
||||
if (`$proc) {
|
||||
`$id = `$proc.Id
|
||||
Write-Host ("SheepIt launcher started (PID: {0})." -f `$id) -ForegroundColor Green
|
||||
Start-Sleep -Seconds 1
|
||||
|
||||
if (Get-Process -Id `$id -ErrorAction SilentlyContinue) {
|
||||
Write-Host ("SheepIt launcher is still running (PID: {0})." -f `$id) -ForegroundColor Green
|
||||
}
|
||||
else {
|
||||
try {
|
||||
`$children = Get-CimInstance Win32_Process -Filter "ParentProcessId=`$id"
|
||||
if (`$children) {
|
||||
Write-Host "Launcher handed off to:" -ForegroundColor Green
|
||||
foreach (`$child in `$children) {
|
||||
Write-Host (" {0} (PID: {1})" -f `$child.Name, `$child.ProcessId) -ForegroundColor Green
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Host "Launcher exited immediately after starting. Check Task Manager for SheepIt/Java processes." -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Host "Unable to inspect child processes." -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Host "SheepIt start confirmed." -ForegroundColor Green
|
||||
}
|
||||
exit 0
|
||||
"@
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user