Skip to content

Commit b5fa146

Browse files
committed
nit: revert EscapeArg to global per usage outside of package
Signed-off-by: Nate Bracy <[email protected]>
1 parent 6902279 commit b5fa146

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

internal/oci/runtime_syscall_exec.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ func (r syscallExec) String() string {
5454
return "exec"
5555
}
5656

57-
// escapeArg escapes shell metacharacters in a single command-line argument.
58-
func escapeArg(arg string) string {
57+
// EscapeArg escapes shell metacharacters in a single command-line argument.
58+
func EscapeArg(arg string) string {
5959
if strings.ContainsAny(arg, shellMetachars) {
6060
return metacharRegex.ReplaceAllString(arg, `\$1`)
6161
}
@@ -67,7 +67,7 @@ func escapeArg(arg string) string {
6767
func Escape(args []string) []string {
6868
escaped := make([]string, len(args))
6969
for i := range args {
70-
escaped[i] = escapeArg(args[i])
70+
escaped[i] = EscapeArg(args[i])
7171
}
7272
return escaped
7373
}

internal/oci/runtime_syscall_exec_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func TestEscape(t *testing.T) {
4040
{
4141
name: "Slice with some Metacharacters",
4242
input: []string{"echo", "Hello World", "and", "goodbye | cat"},
43-
expected: []string{"echo", `"Hello\ World"`, "and", `"goodbye\ \|\ cat"`},
43+
expected: []string{"echo", `Hello\ World`, `and`, `goodbye\ \|\ cat`},
4444
},
4545
}
4646

0 commit comments

Comments
 (0)