Fix managed process helper command serialization
This commit is contained in:
@@ -926,7 +926,7 @@ type ProcessCommand struct {
|
||||
JobID string
|
||||
Capability string
|
||||
Action string
|
||||
OutputLine func(string, string)
|
||||
OutputLine func(string, string) `json:"-"`
|
||||
}
|
||||
|
||||
type ProcessResult struct {
|
||||
|
||||
@@ -569,6 +569,22 @@ func TestOSProcessSupervisorRelaysRawCarriageReturn(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestProcessCommandJSONOmitsOutputCallback(t *testing.T) {
|
||||
body, err := json.Marshal(ProcessCommand{
|
||||
WorkDir: "/workspace",
|
||||
Args: []string{"cmd.exe", "/d", "/c", "call", "start.cmd"},
|
||||
OutputLine: func(stream string, line string) {
|
||||
panic(stream + line)
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("marshal process command with output callback: %v", err)
|
||||
}
|
||||
if strings.Contains(string(body), "OutputLine") || strings.Contains(string(body), "func") {
|
||||
t.Fatalf("output callback leaked into helper JSON: %s", body)
|
||||
}
|
||||
}
|
||||
|
||||
type recordingLogSink struct {
|
||||
mu sync.Mutex
|
||||
lines []string
|
||||
|
||||
Reference in New Issue
Block a user