[debug] now the PowerShell script works (thanks o1-preview and FUCK PowerShell)
This commit is contained in:
		| @@ -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 | # Start the process with redirected standard input | ||||||
| function Simulate-Input { | $processInfo = New-Object System.Diagnostics.ProcessStartInfo | ||||||
|     while ($true) { | $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 |     Start-Sleep -Milliseconds 100 | ||||||
|         "list" |     $process.StandardInput.WriteLine("list") | ||||||
|     Start-Sleep -Milliseconds 100 |     Start-Sleep -Milliseconds 100 | ||||||
|         "get 1" |     $process.StandardInput.WriteLine("get 1") | ||||||
|     Start-Sleep -Milliseconds 100 |     Start-Sleep -Milliseconds 100 | ||||||
|         "get 25" |     $process.StandardInput.WriteLine("get 25") | ||||||
|     } |  | ||||||
| } | } | ||||||
|  |  | ||||||
| # Run cargo command with piped input from the Simulate-Input function | $process.WaitForExit() | ||||||
| Simulate-Input | cargo run -p lanspread-client -- $args |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user