aboutsummaryrefslogtreecommitdiff
path: root/lib/os/exec/exec_test.go
AgeCommit message (Collapse)Author
2026-01-15all: convert license and copyright to use SPDX identifiersShulhan
With help of spdxconv tool [1], we able to bulk update all files license and copyright format to comply with SPDX formats. [1] https://kilabit.info/project/spdxconv/
2024-09-04all: fix various linter warningsShulhan
While at it, temporary disable gosec due to excessive report for G115, which may be true, but may also break the current working program. We should alter and fix once we can test and make sure that it does not breaks.
2024-03-02all: move the repository to "git.sr.ht/~shulhan/pakakeh.go"Shulhan
There are several reasons that why we move from github.com. First, related to the name of package. We accidentally name the package with "share" a common word in English that does not reflect the content of repository. By moving to other repository, we can rename it to better and unique name, in this "pakakeh.go". Pakakeh is Minang word for tools, and ".go" suffix indicate that the repository related to Go programming language. Second, supporting open source. The new repository is hosted under sourcehut.org, the founder is known to support open source, and all their services are licensed under AGPL, unlike GitHub that are closed sources. Third, regarding GitHub CoPilot. The GitHub Terms of Service [1], allow any public content that are hosted there granted them to parse the content. On one side, GitHub helps and flourish the open source, but on another side have an issues regarding scraping the copyleft license [2]. [1]: https://docs.github.com/en/site-policy/github-terms/github-terms-of-service#4-license-grant-to-us [2]: https://githubcopilotinvestigation.com
2021-09-04os/exec: fix escaped quote inside the same quoteShulhan
Shell quote is a hell of complex. For example, one can write shell that execute command that contains quote, sh -c "psql -c 'CREATE ... IDENTIFIED BY PASSWORD '\''pass'\'''" or to simplify, sh -c "psql -c \"CREATE ... IDENTIFIED BY PASSWORD 'pass'\""
2021-08-21Revert "os/exec: include the quoted characters when ParseCommandArgs"Shulhan
This reverts commit 1adcb7901dc62ef288cf82f504f8fae30068b21b. Reason for revert: Given the following string statement: `sh -c "echo a"`, the ParseCommandArgs will return cmd: "sh" args: []string{`-c`, `"echo a"`} If we pass this to exec.Command(cmd, args) and call Run, it will return an error sh: line 1: echo a: command not found
2021-08-13os/exec: include the quoted characters when ParseCommandArgsShulhan
Previously, if we pass `a "b c"` to ParseCommanArgs, it will return `a` as command and `b c` in args. Now, it will return `"b c"` in args with double quotes.
2021-08-11os/exec: check for escaped backslash when ParseCommandArgsShulhan
Given the following string "cmd /a\ b" to ParseCommandArgs now it should return "cmd" and ["/a b"] not ["/a\", "b"], because the space after a is escaped using backslash.
2021-03-14all: refactoring the test.Assert and test.AssertBench signatureShulhan
Previously, the test.Assert and test.AssertBench functions has the boolean parameter to print the stack trace of test in case its not equal. Since this parameter is not mandatory and its usually always set to "true", we remove them from function signature to simplify the call to Assert and AssertBench.
2020-06-04os/exec: new package to simplify the standard "os/exec"Shulhan
New extension to standard package is function ParseCommandArgs() that receive input as string and return itas command and list of arguments. Unlike strings.Fields() which only separated the field by space, ParseCommandArgs can detect possible single, double, or back quotes. Another extension is Run() function that accept the string command to be executed and their standard output and error.