@@ -154,12 +154,8 @@ func run(cmd *cobra.Command, args []string) {
154154 } else {
155155 compileRes , err = compile .Compile (context .Background (), compileReq , os .Stdout , os .Stderr , verboseCompile )
156156 }
157- if err != nil {
158- feedback .Errorf ("Error during build: %v" , err )
159- os .Exit (errorcodes .ErrGeneric )
160- }
161157
162- if uploadAfterCompile {
158+ if err == nil && uploadAfterCompile {
163159 uploadReq := & rpc.UploadReq {
164160 Instance : inst ,
165161 Fqbn : fqbn ,
@@ -189,7 +185,12 @@ func run(cmd *cobra.Command, args []string) {
189185 CompileOut : compileOut .String (),
190186 CompileErr : compileErr .String (),
191187 BuilderResult : compileRes ,
188+ Success : err == nil ,
192189 })
190+ if err != nil && output .OutputFormat != "json" {
191+ feedback .Errorf ("Error during build: %v" , err )
192+ os .Exit (errorcodes .ErrGeneric )
193+ }
193194}
194195
195196// initSketchPath returns the current working directory
@@ -211,6 +212,7 @@ type compileResult struct {
211212 CompileOut string `json:"compiler_out"`
212213 CompileErr string `json:"compiler_err"`
213214 BuilderResult * rpc.CompileResp `json:"builder_result"`
215+ Success bool `json:"success"`
214216}
215217
216218func (r * compileResult ) Data () interface {} {
0 commit comments