-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreadlog.ps1
More file actions
47 lines (39 loc) · 1.31 KB
/
readlog.ps1
File metadata and controls
47 lines (39 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env pwsh
Set-Location tor
$torJob = .\tor\tor.exe -f $pwd/../torrc.win &
Set-Location ..
$codeServerJob = npx code-server &
$hostnameFile = "D:\tmp\hidden_service\hostname"
while (-not (Test-Path $hostnameFile)) {
Write-Host "Waiting for file $hostnameFile ..."
Start-Sleep -Seconds 3
}
Write-Host "====================================="
Get-Content -Path $hostnameFile
Write-Host "====================================="
try {
while ($true) {
$torOutput = Receive-Job -Job $torJob
if ($torOutput) {
$torOutput = $torOutput | Out-String
Write-Host "========================== Tor =========================="
Write-Host $torOutput
}
$codeServerOutput = Receive-Job -Job $codeServerJob
if ($codeServerOutput) {
$codeServerOutput = $codeServerOutput | Out-String
Write-Host "========================== code-server =========================="
Write-Host $codeServerOutput
}
if ($torJob.State -eq 'Completed' -and $codeServerJob.State -eq 'Completed') {
echo "BREAK!"
break
}
Start-Sleep -Seconds 1
}
echo "EXIT!!!"
}
finally {
Write-Host "========================== exit =========================="
Get-Job | Stop-Job | Remove-Job
}