@@ -282,15 +282,18 @@ pub const RunCommand = struct {
282
282
child_process .stdout_behavior = .Inherit ;
283
283
284
284
const result = child_process .spawnAndWait () catch | err | {
285
- Output .prettyErrorln ("<r><red>error<r>: Failed to run script <b>{s}<r> due to error <b>{s}<r>" , .{ name , @errorName (err ) });
285
+ if (! silent ) {
286
+ Output .prettyErrorln ("<r><red>error<r>: Failed to run script <b>{s}<r> due to error <b>{s}<r>" , .{ name , @errorName (err ) });
287
+ }
288
+
286
289
Output .flush ();
287
290
return true ;
288
291
};
289
292
290
293
switch (result ) {
291
294
.Exited = > | code | {
292
295
if (code > 0 ) {
293
- if (code != 2 ) {
296
+ if (code != 2 and ! silent ) {
294
297
Output .prettyErrorln ("<r><red>error<r><d>:<r> script <b>\" {s}\" <r> exited with {any}<r>" , .{ name , bun .SignalCode .from (code ) });
295
298
Output .flush ();
296
299
}
@@ -299,14 +302,18 @@ pub const RunCommand = struct {
299
302
}
300
303
},
301
304
.Signal = > | signal | {
302
- Output .prettyErrorln ("<r><red>error<r><d>:<r> script <b>\" {s}\" <r> exited with {any}<r>" , .{ name , bun .SignalCode .from (signal ) });
303
- Output .flush ();
305
+ if (! silent ) {
306
+ Output .prettyErrorln ("<r><red>error<r><d>:<r> script <b>\" {s}\" <r> exited with {any}<r>" , .{ name , bun .SignalCode .from (signal ) });
307
+ Output .flush ();
308
+ }
304
309
305
310
Global .exit (1 );
306
311
},
307
312
.Stopped = > | signal | {
308
- Output .prettyErrorln ("<r><red>error<r><d>:<r> script <b>\" {s}\" <r> was stopped by signal {any}<r>" , .{ name , bun .SignalCode .from (signal ) });
309
- Output .flush ();
313
+ if (! silent ) {
314
+ Output .prettyErrorln ("<r><red>error<r><d>:<r> script <b>\" {s}\" <r> was stopped by signal {any}<r>" , .{ name , bun .SignalCode .from (signal ) });
315
+ Output .flush ();
316
+ }
310
317
311
318
Global .exit (1 );
312
319
},
@@ -341,6 +348,7 @@ pub const RunCommand = struct {
341
348
child_process .stderr_behavior = .Inherit ;
342
349
child_process .stdin_behavior = .Inherit ;
343
350
child_process .stdout_behavior = .Inherit ;
351
+ const silent = ctx .debug .silent ;
344
352
345
353
const result = child_process .spawnAndWait () catch | err | {
346
354
if (err == error .AccessDenied ) {
@@ -349,7 +357,8 @@ pub const RunCommand = struct {
349
357
const rc = bun .C .stat (executable [0.. :0 ].ptr , & stat );
350
358
if (rc == 0 ) {
351
359
if (std .os .S .ISDIR (stat .mode )) {
352
- Output .prettyErrorln ("<r><red>error<r>: Failed to run directory \" <b>{s}<r>\" \n " , .{executable });
360
+ if (! silent )
361
+ Output .prettyErrorln ("<r><red>error<r>: Failed to run directory \" <b>{s}<r>\" \n " , .{executable });
353
362
Global .exit (1 );
354
363
}
355
364
}
@@ -361,24 +370,25 @@ pub const RunCommand = struct {
361
370
switch (result ) {
362
371
.Exited = > | sig | {
363
372
// 2 is SIGINT, which is CTRL + C so that's kind of annoying to show
364
- if (sig > 0 and sig != 2 )
373
+ if (sig > 0 and sig != 2 and ! silent )
365
374
Output .prettyErrorln ("<r><red>error<r><d>:<r> \" <b>{s}<r>\" exited with <b>{any}<r>" , .{ std .fs .path .basename (executable ), bun .SignalCode .from (sig ) });
366
375
Global .exit (sig );
367
376
},
368
377
.Signal = > | sig | {
369
378
// 2 is SIGINT, which is CTRL + C so that's kind of annoying to show
370
- if (sig > 0 and sig != 2 ) {
379
+ if (sig > 0 and sig != 2 and ! silent ) {
371
380
Output .prettyErrorln ("<r><red>error<r><d>:<r> \" <b>{s}<r>\" exited with <b>{any}<r>" , .{ std .fs .path .basename (executable ), bun .SignalCode .from (sig ) });
372
381
}
373
382
Global .exit (std .mem .asBytes (& sig )[0 ]);
374
383
},
375
384
.Stopped = > | sig | {
376
- if (sig > 0 )
385
+ if (sig > 0 and ! silent )
377
386
Output .prettyErrorln ("<r><red>error<r> \" <b>{s}<r>\" stopped with {any}<r>" , .{ std .fs .path .basename (executable ), bun .SignalCode .from (sig ) });
378
387
Global .exit (std .mem .asBytes (& sig )[0 ]);
379
388
},
380
389
.Unknown = > | sig | {
381
- Output .prettyErrorln ("<r><red>error<r> \" <b>{s}<r>\" stopped: {d}<r>" , .{ std .fs .path .basename (executable ), sig });
390
+ if (! silent )
391
+ Output .prettyErrorln ("<r><red>error<r> \" <b>{s}<r>\" stopped: {d}<r>" , .{ std .fs .path .basename (executable ), sig });
382
392
Global .exit (1 );
383
393
},
384
394
}
@@ -955,7 +965,8 @@ pub const RunCommand = struct {
955
965
// "White space after #! is optional."
956
966
var shebang_buf : [64 ]u8 = undefined ;
957
967
const shebang_size = file .pread (& shebang_buf , 0 ) catch | err | {
958
- Output .prettyErrorln ("<r><red>error<r>: Failed to read file <b>{s}<r> due to error <b>{s}<r>" , .{ file_path , @errorName (err ) });
968
+ if (! ctx .debug .silent )
969
+ Output .prettyErrorln ("<r><red>error<r>: Failed to read file <b>{s}<r> due to error <b>{s}<r>" , .{ file_path , @errorName (err ) });
959
970
Global .exit (1 );
960
971
};
961
972
0 commit comments