Skip to content

Handle relative paths starting with hyphens in io's rmRF #1005

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

twz123
Copy link

@twz123 twz123 commented Feb 23, 2022

When using io.rmRF with a relative path to a directory that starts with a hyphen on non-Windows systems, the directory name was interpreted as an option to rm. Fix that by separating options and arguments via a double-hyphen --.

Without this change, the provided test fails with:

    Command failed: rm -rf -hyphen
    rm: invalid option -- 'h'
    Try 'rm ./-hyphen' to remove the file '-hyphen'.
    Try 'rm --help' for more information.

When using `io.rmRF` with a relative path to a directory that starts
with a hyphen on non-Windows systems, the directory name was interpreted
as an option to `rm`. Fix that by separating options and arguments via a
double-hyphen `--`.
@twz123 twz123 requested a review from a team as a code owner February 23, 2022 08:38
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.

1 participant