knqyf263 / pet

Simple command-line snippet manager
MIT License
4.41k stars 222 forks source link

Fix execution of command with quotes on windows. #241

Closed matrixx567 closed 7 months ago

matrixx567 commented 7 months ago

Issue

138 #238

Description of changes:

Commands with quotes can't be handled on windows using standard exec.Command() calls. Based on the go documentation https://pkg.go.dev/os/exec#Command the argument handling is converted to SysProcAttr.

Split run function into OS dependent source files.

RamiAwar commented 7 months ago

Thanks for the PR @matrixx567! Everything LGTM.

Will need a few days to test it and double check everything runs fine (currently traveling, no windows machine), but will merge it asap.

RamiAwar commented 7 months ago

Hey @matrixx567, thanks for the PR. Tested it out and it looks good.

To be clear on how I tested: I tried building pet without these changes and ran it on windows with the command echo "hello world" This resulted in: \"hello world\"

Tried building pet on your branch and ran it again with the same input and I got "hello world".