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

Implement Execv function (equivalent to Exec but with args passed as … #189

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

Conversation

paulc
Copy link

@paulc paulc commented Aug 25, 2023

Hello,

Really enjoying using script however there have been a couple of use cases where I have wanted to avoid interpolating the Exec args into a single cmdLIne (and worrying about quoting - which can be complex if dealing with arbitrary input) and have therefore added an Execv(cmd string, args []string) method which passes the cmd and args separately as []string (which is what gets passed to exec.Command anyway so saves re-parsing the command line).

Think this would be a useful addition (and be safer for scripts which make need to Exec commands where some of the parameters are untrusted)

…[]string vs inetrpolated into single cmdLine)
@paulc paulc mentioned this pull request Aug 25, 2023
Comment on lines +425 to +426
err := cmd.Start()
if err != nil {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
err := cmd.Start()
if err != nil {
if err := cmd.Start(); err != nil {

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.

None yet

2 participants