Skip to content
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

Empty Pipe runs One job instead of Zero #197

Open
fjf2002 opened this issue Dec 31, 2018 · 5 comments
Open

Empty Pipe runs One job instead of Zero #197

fjf2002 opened this issue Dec 31, 2018 · 5 comments

Comments

@fjf2002
Copy link

fjf2002 commented Dec 31, 2018

Do you want to request a feature or report a bug?
In my opinion this is a bug, cf.

@() | foreach { 1 }

What is the current behavior?
Start-RSJob runs one job.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

@() | Start-RSJob { 1 } | wait-rsjob | Receive-RSJob

... outputs "1" ...

What is the expected behavior?
... instead of nothing.

Which versions of Powershell and which OS are affected by this issue? Did this work in previous versions of our scripts?
Powershell 5.1, Windows Server 2016

Please provide a code example showing the issue, if applicable:

@() | Start-RSJob { 1 } | wait-rsjob | Receive-RSJob
@MVKozlov
Copy link
Contributor

I think this is not a bug, because Foreach-Object can't work without pipeline at all but Start-RSJob can

@fjf2002
Copy link
Author

fjf2002 commented Jan 7, 2019

Well, I insist that Start-RSJob "does the wrong thing" on an empty pipeline. Each time I use Start-RSJob on a pipeline, I need boilerplate code to catch this edge case.

@MVKozlov
Copy link
Contributor

MVKozlov commented Jan 7, 2019

so, may be you have a method to determine if there is empty pipeline or no pipeline?
If so that can be implemented

@fjf2002
Copy link
Author

fjf2002 commented Jan 7, 2019

Yep, and you could call the method foreach-rsparallel or something like that.

Nevertheless Start-RSJob on its own would still "do the wrong thing" on an empty pipeline. I consider that a bug.

The problem is, Start-RSJob currently tries to solve two partially contradicting tasks, i.e.

  1. Starting one job with no input and
  2. Starting a number of jobs that work on the pipeline.

@MVKozlov
Copy link
Contributor

MVKozlov commented Jan 8, 2019

so, where the code example ? ;-)

MVKozlov added a commit to MVKozlov/PoshRSJob that referenced this issue Jan 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants