File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -29,8 +29,8 @@ type ResultSet []Result
29
29
30
30
// Plugin defines a partial struct that captures plugin type
31
31
type Plugin struct {
32
- Type string `json:"type"`
33
- json.RawMessage
32
+ Type string `json:"type"`
33
+ Args json.RawMessage `json:"args"`
34
34
}
35
35
36
36
// Check defines a set of expected/actual plugins
@@ -84,7 +84,11 @@ func (p Plugin) Run() Value {
84
84
if err != nil {
85
85
return Value {Error : err }
86
86
}
87
- stdin .Write (p .RawMessage )
87
+ if len (p .Args ) == 0 {
88
+ stdin .Write ([]byte ("{}" ))
89
+ } else {
90
+ stdin .Write (p .Args )
91
+ }
88
92
stdin .Close ()
89
93
90
94
var stdoutBytes bytes.Buffer
@@ -94,10 +98,10 @@ func (p Plugin) Run() Value {
94
98
cmd .Stderr = & stderrBytes
95
99
err = cmd .Run ()
96
100
if err != nil {
97
- return Value {Error : fmt .Errorf ("%s: %s" , err , stderrBytes .String ())}
101
+ return Value {Error : fmt .Errorf ("%s: %s" , err , strings . TrimSpace ( stderrBytes .String () ))}
98
102
}
99
103
100
- return Value {Output : stdoutBytes .String ()}
104
+ return Value {Output : strings . TrimSpace ( stdoutBytes .String () )}
101
105
}
102
106
103
107
// Matches checks if a result ran successfully and if its expected and actual values match
You can’t perform that action at this time.
0 commit comments