-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7838 from mook-as/factory-reset/use-jobs
Win32: Spawn extension processes in job
- Loading branch information
Showing
10 changed files
with
432 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package process | ||
|
||
import ( | ||
"strings" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
"golang.org/x/sys/windows" | ||
) | ||
|
||
func TestBuildCommandLine(t *testing.T) { | ||
t.Parallel() | ||
cases := [][]string{ | ||
{"arg0", "a b c", "d", "e"}, | ||
{"C:\\Program Files\\arg0\\\\", "ab\"c", "\\", "d"}, | ||
{"\\\\", "a\\\\\\b", "de fg", "h"}, | ||
{"arg0", "a\\\"b", "c", "d"}, | ||
{"arg0", "a\\\\b c", "d", "e"}, | ||
{"arg0", "ab\" c d"}, | ||
{"C:/Path\\with/mixed slashes"}, | ||
{"arg0", " leading", " and ", "trailing ", "space"}, | ||
{"special characters", "&", "|", ">", "<", "*", "\"", " "}, | ||
} | ||
for _, testcase := range cases { | ||
t.Run(strings.Join(testcase, " "), func(t *testing.T) { | ||
t.Parallel() | ||
result := buildCommandLine(testcase) | ||
argv, err := windows.DecomposeCommandLine(result) | ||
require.NoError(t, err, "failed to parse result %s", result) | ||
assert.Equal(t, testcase, argv, "failed to round trip arguments via [%s]", result) | ||
}) | ||
} | ||
} |
Oops, something went wrong.