Skip to content

Commit 2844580

Browse files
committed
Remove SetTimeoutMS function calls
1 parent 72a7917 commit 2844580

File tree

3 files changed

+3
-14
lines changed

3 files changed

+3
-14
lines changed

command_darwin.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,9 @@ package cmd
22

33
import (
44
"os/exec"
5-
"strings"
65
)
76

87
func createBaseCommand(c *Command) *exec.Cmd {
98
cmd := exec.Command("/bin/sh", "-c", c.Command)
109
return cmd
1110
}
12-
13-
func (c *Command) removeLineBreaks(text string) string {
14-
return strings.Trim(text, "\n")
15-
}

command_darwin_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cmd
33
import (
44
"github.com/stretchr/testify/assert"
55
"testing"
6+
"time"
67
)
78

89
func TestCommand_ExecuteStderr(t *testing.T) {
@@ -15,8 +16,7 @@ func TestCommand_ExecuteStderr(t *testing.T) {
1516
}
1617

1718
func TestCommand_WithTimeout(t *testing.T) {
18-
cmd := NewCommand("sleep 0.5;")
19-
cmd.SetTimeoutMS(5)
19+
cmd := NewCommand("sleep 0.5;", WithTimeout(5*time.Millisecond))
2020

2121
err := cmd.Execute()
2222

@@ -25,8 +25,7 @@ func TestCommand_WithTimeout(t *testing.T) {
2525
}
2626

2727
func TestCommand_WithValidTimeout(t *testing.T) {
28-
cmd := NewCommand("sleep 0.01;")
29-
cmd.SetTimeoutMS(500)
28+
cmd := NewCommand("sleep 0.01;", WithTimeout(500*time.Millisecond))
3029

3130
err := cmd.Execute()
3231

command_windows.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,9 @@ package cmd
22

33
import (
44
"os/exec"
5-
"strings"
65
)
76

87
func createBaseCommand(c *Command) *exec.Cmd {
98
cmd := exec.Command(`C:\windows\system32\cmd.exe`, "/C", c.Command)
109
return cmd
1110
}
12-
13-
func (c *Command) removeLineBreaks(text string) string {
14-
return strings.Trim(text, "\r\n")
15-
}

0 commit comments

Comments
 (0)