fix: rework setupShellCommand (#930)

* fix: rework `setupShellCommand`

* move all logic to separate function so we can test that later
* split `step.Shell` and `step.WorkingDirectory` setup into own funcs
* general cleanup of function
* use `ActPath` to not collide with checked out repository
* use `shellquote.Split()` instead of `strings.Fields()` for better command split
* replace single string concat with `fmt`

Signed-off-by: hackercat <me@hackerc.at>

* lint(editorconfig): ignore *_test.go due to mixed style

Signed-off-by: hackercat <me@hackerc.at>
这个提交包含在:
Ryan
2021-12-22 07:37:16 +01:00
提交者 GitHub
父节点 4e0ba618d3
当前提交 adabf2a202
共有 9 个文件被更改,包括 168 次插入83 次删除

查看文件

@@ -266,6 +266,7 @@ func TestStep_ShellCommand(t *testing.T) {
shell string
want string
}{
{"pwsh -v '. {0}'", "pwsh -v '. {0}'"},
{"pwsh", "pwsh -command . '{0}'"},
{"powershell", "powershell -command . '{0}'"},
}