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

Include cwd in jack-in command line #2150

Merged
merged 5 commits into from
Apr 10, 2023
Merged

Include cwd in jack-in command line #2150

merged 5 commits into from
Apr 10, 2023

Conversation

PEZ
Copy link
Collaborator

@PEZ PEZ commented Apr 9, 2023

What has changed?

When constructing the Jack-in command line we wrap it in pushd changing the working directory to the started project's root and then popd to restore. The command line gets to be: (pushd <project-root> <;|&> <jack-in-command-line> <;|&> popd. The commands are separated by & on Windows/cmd.exe and by ; on Mac/Linux.

My Calva PR Checklist

I have:

  • Read How to Contribute.
  • Directed this pull request at the dev branch. (Or have specific reasons to target some other branch.)
  • Made sure I have changed the PR base branch, so that it is not published. (Sorry for the nagging.)
  • Updated the [Unreleased] entry in CHANGELOG.md, linking the issue(s) that the PR is addressing.
  • Figured if anything about the fix warrants tests on Mac/Linux/Windows/Remote/Whatever, and either tested it there if so, or mentioned it in the PR.
  • Added to or updated docs in this branch, if appropriate
  • Tests
    • Tested the particular change
    • Figured if the change might have some side effects and tested those as well.
  • Referenced the issue I am fixing/addressing in a commit message for the pull request.
  • Created the issue I am fixing/addressing, if it was not present.
  • Formatted all JavaScript and TypeScript code that was changed. (use the prettier extension or run npm run prettier-format)
  • Confirmed that there are no linter warnings or errors (use the eslint extension, run npm run eslint before creating your PR, or run npm run eslint-watch to eslint as you go).

Ping @PEZ, @bpringe, @corasaurus-hex, @Cyrik

@PEZ PEZ requested a review from bpringe April 9, 2023 20:01
@bpringe
Copy link
Member

bpringe commented Apr 9, 2023

What's the point of wrapping the command in parens?

@PEZ
Copy link
Collaborator Author

PEZ commented Apr 10, 2023

What's the point of wrapping the command in parens?

It's what creates the sub shell. So if you copy the command and run it, then exit from it, you will be back in the same current directory as from where you started it.

@PEZ PEZ force-pushed the 2147-include-cwd-in-jack-in branch from 4f0a8f4 to 42f41ed Compare April 10, 2023 06:13
@PEZ PEZ changed the title Run jack-in command in a shubshell, including cwd Include cwd in jack-in command line Apr 10, 2023
@PEZ
Copy link
Collaborator Author

PEZ commented Apr 10, 2023

That said. I now tested it on Windows, and it doesn't create a sub shell there, so not as universal as I had hoped. Now using pushd/popd instead to achieve the same effect. To my surprise those commands exist in cmd.exe.

@PEZ PEZ merged commit 654c880 into dev Apr 10, 2023
@PEZ PEZ deleted the 2147-include-cwd-in-jack-in branch April 10, 2023 09:57
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

Successfully merging this pull request may close these issues.

2 participants