-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Receive-RSJob does not respect common *Variable and *Action parameters #146
Comments
Note: I've worked around this problem locally by updating WriteStream.ps1 to better understand the current preference settings (assigned by the *-ActionPreference switches). This is a hack which needs to be properly fixed in PoshRSJob, but at least I can make Receive-RsJob stop polluting the output for now. Note that I started to add handling of the Information stream as well, but this requires more work in the PoshRSJob.psm1 class declarations, etc. etc. to fully support the stream, so it is actually commented out in the appropriate place here. (Updated) code for WriteStream.ps1 is as follows:
|
I think will be better to ask @proxb why |
This also makes it very hard to use this module in for example Azure Automation, the error output is simply "lost" when the $host.Ui.Write functions are used. |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
I would expect that Receive-RSJob with the proper -*Action and -*Variable parameters in place would be SILENT, especially if pipeline is further directed to Out-Null, but this is not the case. Because this still forcibly output they pollute the output of the script running them. It should be possible to run this QUIETLY, but
InformationVariable / WarningVariable / ErrorVariable / InformationAction / WarningAction / ErrorAction seem to have no effect.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
a) most *Variable parameters are not respected and output variables are not assigned content
b) *Action parameters are not respected and content is output according to behavior variables outside of Receive-RSJob
What is the expected behavior?
If I simply want to use ReceiveRSJob to mark input job(s) with the HasMoreData == False (to know that their results have been processed), I should be able to:
$null = $completedJobs | Receive-RSJob -OutVariable null -InformationVariable null -WarningVariable null -ErrorVariable null -InformationAction SilentlyContinue -WarningAction SilentlyContinue -ErrorAction SilentlyContinue | Out-Null
...and would expect that there is NO further output to the host, error stream, etc. etc., because _everything is redirected to the null var or Out-Null, but this is not the current outcome. I still get all the error, warning, etc. stream output to the host.
Which versions of Powershell and which OS are affected by this issue? Did this work in previous versions of our scripts?
Please provide a code example showing the issue, if applicable:
The text was updated successfully, but these errors were encountered: