Skip to content

Commit 30a168a

Browse files
committed
add shellquote
1 parent 2242164 commit 30a168a

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"runtime"
1616
"sort"
1717
"strings"
18-
"syscall"
1918
"time"
2019

2120
"github.com/BurntSushi/toml"
@@ -272,7 +271,7 @@ func escape(name string) string {
272271
func runcmd(command string, files ...string) error {
273272
var args []string
274273
for _, file := range files {
275-
args = append(args, syscall.EscapeArg(file))
274+
args = append(args, shellquote(file))
276275
}
277276
var cmd *exec.Cmd
278277
if runtime.GOOS == "windows" {

util_posix.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// +build !windows
2+
3+
package main
4+
5+
import "fmt"
6+
7+
func shellquote(s string) string {
8+
return fmt.Sprintf("%q", s)
9+
}

util_windows.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// +build windows
2+
3+
package main
4+
5+
import "syscall"
6+
7+
func shellquote(s string) string {
8+
return syscall.EscapeArg(s)
9+
}

0 commit comments

Comments
 (0)