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
Updated background invocation &
operator to use -WorkingDirectory when starting a new job
#16180
Conversation
@ayousuf23 Please add test(s) for a scenario you enhance. |
@ayousuf23 thanks for creating this PR, I like that you've added a thorough summary and context for this PR as this is really helpful :) the code looks good but having tests will just help us verify it works as expected, this is something we can talk about in the Semester of Code office hours this week, thanks again for creating this! |
3279c97
to
a8f79c8
Compare
I accidentally erased my previous commit from this PR. I will add the previous commit. |
…ing directory of new job and added a testto ensure background job script block does not use Set-Location to set working directory
a8f79c8
to
412fffa
Compare
Right now, the build is failing on my computer. I think this is because of other files (not the ones I changed). @iSazonov I added a test to ensure |
I see old code and new code to set location to PWD. I think we already have tests for |
Please create new branch on a commit before #15177, apply your commits and check if test fails still exist. /cc @daxian-dbw |
@iSazonov Thank you for your suggestion. I will add another test. |
…ackground job's working directory
@iSazonov I added a test to ensure changing the working directory also changes a new background job's working directory. |
@ayousuf23 Please look test fails. |
I merged the master branch with |
Master always stable - we never merge a commit if there are fail tests. |
@iSazonov Thank you for your suggestion. I’ll try and get the failing tests fixed this week :) |
@iSazonov I think I fixed the issue. I am waiting for the tests to run in order to be sure. |
@iSazonov The tests passed :) |
$j = (get-variable -value ExecutionContext).SessionState.PSVariable.Get("MyInvocation").Value.MyCommand.ScriptBlock & | ||
(Receive-Job -Wait $j).ToString() | Should -BeExactly "(get-variable -value ExecutionContext).SessionState.PSVariable.Get(`"MyInvocation`").Value.MyCommand.ScriptBlock" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$j = (get-variable -value ExecutionContext).SessionState.PSVariable.Get("MyInvocation").Value.MyCommand.ScriptBlock & | |
(Receive-Job -Wait $j).ToString() | Should -BeExactly "(get-variable -value ExecutionContext).SessionState.PSVariable.Get(`"MyInvocation`").Value.MyCommand.ScriptBlock" | |
$j = (Get-Variable -Value ExecutionContext).SessionState.PSVariable.Get("MyInvocation").Value.MyCommand.ScriptBlock & | |
(Receive-Job -Wait $j).ToString() | Should -BeExactly "(Get-Variable -Value ExecutionContext).SessionState.PSVariable.Get(`"MyInvocation`").Value.MyCommand.ScriptBlock" |
@anamnavi Sorry for the late response. I added parameter names for the arguments, as you suggested. |
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
@iSazonov Is there anything remaining for me to do in order to get the PR merged? |
@ayousuf23 We are waiting a review from anybody from MSFT team.. |
@anamnavi Can you please review this PR? |
@ayousuf23 Sorry for the delay of response from the team. Can you please mention the number of the issue that you fixed with this PR in the PR description (in the form @anamnavi already signed off. I will ping @TravisEz13 offline to remind him of this PR. |
@daxian-dbw Thanks for your comment! I updated the PR's description. |
@daxian-dbw I see the error on Windows CI "##[error]This is a scheduled windows-2016 brownout. The windows-2016 environment is deprecated and will be removed on March 15, 2022. For more details, see actions/runner-images#4312" |
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
@ayousuf23 Thanks for your contribution! |
PR Summary
Updated the background invocation
&
operator to use -WorkingDirectory parameter when starting a new job.Fix #10515
PR Context
Previously,
Set-Location
was appended to the script block ofStart-Job
in order to set the working directory of a new job invoked by the background invocation operator&
. Now thatStart-Job
accepts a-WorkingDirectory
parameter that sets the working directory of the new job, it makes sense to update the code for using the background invocation operator to use the new way of setting the working directory of a new job.PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.(which runs in a different PS Host).