-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Fix: Don't change working directory when invoking tsp-client #53156
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
Conversation
Replace Push-Location/Pop-Location with npm --prefix option to avoid changing the working directory before invoking tsp-client. This fixes the issue where tsp-client makes assumptions based on the working directory. Co-authored-by: JoshLove-msft <[email protected]>
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.
Pull Request Overview
This PR fixes a working directory issue in the PowerShell script Invoke-GenerateAndBuildV2.ps1 where the script was changing the working directory before invoking tsp-client, which caused problems because tsp-client makes assumptions based on the current working directory.
Key changes:
- Removed the
Push-Location/Pop-Locationpattern that was changing the working directory - Used npm's
--prefixoption to specify the target directory without changing the current working directory - Maintained the same functionality while avoiding the working directory change issue
Keep Push-Location for npm ci as required, but execute tsp-client using the full path to the binary. This ensures npm ci runs from the correct directory while tsp-client executes from the current working directory. Co-authored-by: JoshLove-msft <[email protected]>
Keep Push-Location/Pop-Location for npm ci, then use npm exec --prefix to invoke tsp-client from the current working directory while using the pinned version from tsp-client directory. Co-authored-by: JoshLove-msft <[email protected]>
|
/check-enforcer evaluate |
Problem
PR #52973 introduced a change that uses
Push-Locationto change the working directory toeng/common/tsp-clientbefore invokingtsp-client. This causes issues becausetsp-clientmakes assumptions based on the current working directory where it's executed.Solution
This PR keeps
Push-Location/Pop-Locationfornpm ci(which requires running from the tsp-client directory) but executes tsp-client usingnpm exec --prefixinstead of running it from within the changed directory. This ensures:eng/common/tsp-clientis usedChanges
Before:
After:
This ensures that
tsp-clientruns from the correct working directory where it can properly resolve paths and make its assumptions, while still using the pinned version fromeng/common/tsp-client.Fixes #53155
Original prompt
Fixes #53155
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.