-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Description
Using the argument -Logfile - doesn't work, though I haven't been able to get it work at all in powershell so I'm not sure if there are other issues going on.
This is what I ended up with, even if it didn't work (using the add event function crashed with a stack overflow so using Register-ObjectEvent):
function writeLog([System.Object] $sender, [System.Diagnostics.DataReceivedEventArgs] $e) {
if ($e.Data) { Write-Output $e.Data }
}
Register-ObjectEvent -InputObj $process -Event "OutputDataReceived" -Action { writeLog(args) } -ErrorAction Stop | Out-Null
Register-ObjectEvent -InputObj $process -Event "ErrorDataReceived" -Action { writeLog(args) } -ErrorAction Stop | Out-Null
$process.Start() | Out-Null
$process.BeginOutputReadLine()
$process.BeginErrorReadLine()Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels