[debug] now the PowerShell script works (thanks o1-preview and FUCK PowerShell)

This commit is contained in:
ddidderr 2024-11-08 23:23:38 +01:00
parent b654042d57
commit 70c327ff03
Signed by: ddidderr
GPG Key ID: 3841F1C27E6F0E14

View File

@ -1,17 +1,24 @@
# Set environment variable
$env:RUST_LOG = "info,lanspread_client=debug,lanspread_proto=debug"
$Env:RUST_LOG = "info,lanspread_client=debug,lanspread_proto=debug"
# Define a function to simulate the input sequence
function Simulate-Input {
while ($true) {
Start-Sleep -Milliseconds 100
"list"
Start-Sleep -Milliseconds 100
"get 1"
Start-Sleep -Milliseconds 100
"get 25"
}
# Start the process with redirected standard input
$processInfo = New-Object System.Diagnostics.ProcessStartInfo
$processInfo.FileName = "cargo"
$processInfo.Arguments = "run -p lanspread-client -- $args"
$processInfo.UseShellExecute = $false
$processInfo.RedirectStandardInput = $true
$process = New-Object System.Diagnostics.Process
$process.StartInfo = $processInfo
$process.Start() | Out-Null
# Continuously write commands to the standard input of the process
while (!$process.HasExited) {
Start-Sleep -Milliseconds 100
$process.StandardInput.WriteLine("list")
Start-Sleep -Milliseconds 100
$process.StandardInput.WriteLine("get 1")
Start-Sleep -Milliseconds 100
$process.StandardInput.WriteLine("get 25")
}
# Run cargo command with piped input from the Simulate-Input function
Simulate-Input | cargo run -p lanspread-client -- $args
$process.WaitForExit()