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

Introduce ShellQuoted to avoid shell quoting issues #56

Merged
merged 10 commits into from
Dec 1, 2023

Conversation

vemoo
Copy link
Contributor

@vemoo vemoo commented Oct 26, 2023

There was a shell quoting issue here:

pn/src/main.rs

Line 112 in 9c9654a

pass_to_sub(args.join(" "))

Where pn echo ';ls' would end up running ls.

This PR introduces ShellQuoted that takes care of quoting, and changes functions that end up calling sh -c ... to use that as parameter, to reduce the chance of reintroducing this kind of issue.

Another option is to avoid calling sh -c ... and instead use https://github.com/denoland/deno_task_shell which will also have the benefit of being more consistent across operating systems.

src/error.rs Outdated Show resolved Hide resolved
src/shell_quoted.rs Outdated Show resolved Hide resolved
src/shell_quoted.rs Outdated Show resolved Hide resolved
src/shell_quoted.rs Outdated Show resolved Hide resolved
tests/test_main.rs Outdated Show resolved Hide resolved
src/shell_quoted.rs Outdated Show resolved Hide resolved
@vemoo vemoo requested a review from KSXGitHub November 29, 2023 20:03
src/shell_quoted.rs Outdated Show resolved Hide resolved
src/shell_quoted.rs Outdated Show resolved Hide resolved
@zkochan zkochan merged commit 3943d6e into pnpm:main Dec 1, 2023
5 checks passed
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.

3 participants