WriteStream (Receive-Job) output cannot be redirected
Opened this issue · 1 comments
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Receive-Job
uses WriteStream writes streams (warning, error, etc) directly tot he $host
.
Redirect (e.g. *>&1
) and Common Params -WarningVariable foo
do not seem to function as expected.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
Redirection
Start-RSJob -ScriptBlock { write-warning 'warning'; write-error 'error' } | Wait-RSJob |
Receive-RSJob *>&1
WARNING: warning
error
Common Params
Start-RSJob -ScriptBlock { write-warning 'warning'; write-error 'error' } | Wait-RSJob |
Receive-RSJob -WarningVariable wv; $wv
WARNING: warning
error
What is the expected behavior?
Some manner to capture warning/error output streams (e.g. for logging)
Which versions of Powershell and which OS are affected by this issue? Did this work in previous versions of our scripts?
v5.1 Windows
PsRsJob 1.7.3.9
Please provide a code example showing the issue, if applicable:
See above
Any scope for re-direction?