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

Add -- instead of performing a short-circuit upon detecting a script-block. #38

Open
luke-beep opened this issue Feb 9, 2024 · 2 comments
Labels
Issue-Task It's a feature request, but it doesn't really need a major design.

Comments

@luke-beep
Copy link

Description of the new feature / enhancement

Enhance sudo to recognize and support script blocks prefixed with --. Currently, the script will short-circuit and execute script blocks directly, leading to perhaps unexpected behavior. By introducing support for the -- prefix, users can clearly indicate when a following argument is a script block.

Scenario when this would be used?

One scenario where adding support for the -- argument for script blocks would be useful is when users need to pass a script block as an argument to the sudo command within a command line environment.

With the -- argument implemented, users can specify script blocks explicitly, ensuring that they are processed correctly by sudo. This can be particularly useful in automation scenarios, scripting tasks, or when invoking sudo from other scripts or tools where passing script blocks as arguments is necessary. Call it free will if you may.

Supporting information

  • Sudo Manual -> Sudo
@luke-beep luke-beep added Issue-Feature New feature or request. Complex enough to require planning and actual budgeted, scheduled work. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Feb 9, 2024
@joadoumie
Copy link
Contributor

Thanks for the feedback - I'm going to remove the needs triage label and keep the Issue-Feature tag.

Out of curiosity, do you have any specific examples that we can add to the issue here for tracking? I'm sure I can come up with some, but it'd be great if you have some examples we can use!

@joadoumie joadoumie removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Feb 20, 2024
@luke-beep
Copy link
Author

One scenario where this enhancement is valuable is in situations where users need to pass script blocks as arguments to sudo.

sudo -- ./script.ps1 --param1 value1 --param2 value2.

@zadjii-msft zadjii-msft added Issue-Task It's a feature request, but it doesn't really need a major design. and removed Issue-Feature New feature or request. Complex enough to require planning and actual budgeted, scheduled work. labels Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Task It's a feature request, but it doesn't really need a major design.
Projects
None yet
Development

No branches or pull requests

3 participants