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

Support commands argument quoting on Windows #1633

Closed
ferki opened this issue Jan 19, 2025 · 0 comments · Fixed by #1634
Closed

Support commands argument quoting on Windows #1633

ferki opened this issue Jan 19, 2025 · 0 comments · Fixed by #1634
Labels
feature request A suggested idea for the project

Comments

@ferki
Copy link
Member

ferki commented Jan 19, 2025

As

maintainer

I would like to

enable command argument quoting on Windows

so I can

avoid making special cases for tests and features on Windows

Additional context

I ran into this while working on #1632.

Describe the solution you would like

I'd like to pass a single command (with its list of arguments) and let Rex figure out the quoting depending on where it gets executed.

For example:

  • I'd like to run the following command: run 'perl', [ '-e', 'print $ENV{VAR}' ]
  • which needs different quoting depending on the target operating system's environment:
    • Windows: perl -e "print $ENV{VAR}"
    • ~non-Windows: perl -e 'print $ENV{VAR}'

Since we already use Net::OpenSSH::ShellQuoter with run(), I'd like it to recognize if the target system is Windows, and quote accordingly.

Perhals i_run(), i_exec(), and i_exec_nohup() could make use of the same idea too (now or later.)

Describe alternatives you have considered

Manually checking if the managed endpoints is Windows (for example while executing tests locally), and prepare slightly different versions of the same command.

Sometimes the test suite skips tests on Windows due to the difficulty.

@ferki ferki added the feature request A suggested idea for the project label Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request A suggested idea for the project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant