proxb / PoshRSJob

Provides an alternative to PSjobs with greater performance and less overhead to run commands in the background, freeing up the console and allowing throttling on the jobs.
MIT License
541 stars 87 forks source link

WriteStream (Receive-Job) output cannot be redirected #172

Open jdkang opened 6 years ago

jdkang commented 6 years ago

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

ghost commented 6 years ago

Any scope for re-direction?