File tree Expand file tree Collapse file tree 1 file changed +33
-2
lines changed
packages/@vue/cli-ui/apollo-server/connectors Expand file tree Collapse file tree 1 file changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -298,7 +298,8 @@ async function run (id, context) {
298
298
299
299
const child = execa ( command , args , {
300
300
cwd : cwd . get ( ) ,
301
- stdio : [ 'inherit' , 'pipe' , 'pipe' ]
301
+ stdio : [ 'inherit' , 'pipe' , 'pipe' ] ,
302
+ shell : true
302
303
} )
303
304
304
305
if ( typeof nodeEnv !== 'undefined' ) {
@@ -409,6 +410,28 @@ async function run (id, context) {
409
410
410
411
child . on ( 'exit' , onExit )
411
412
413
+ child . on ( 'error' , error => {
414
+ updateOne ( {
415
+ id : task . id ,
416
+ status : 'error'
417
+ } , context )
418
+ logs . add ( {
419
+ message : `Error while running task ${ task . id } with message'${ error . message } '` ,
420
+ type : 'error'
421
+ } , context )
422
+ notify ( {
423
+ title : `Task error` ,
424
+ message : `Error while running task ${ task . id } with message'${ error . message } '` ,
425
+ icon : 'error'
426
+ } )
427
+ addLog ( {
428
+ taskId : task . id ,
429
+ type : 'stdout' ,
430
+ text : chalk . red ( `Error while running task ${ task . id } with message '${ error . message } '` )
431
+ } , context )
432
+ console . error ( error )
433
+ } )
434
+
412
435
// Plugin API
413
436
if ( task . onRun ) {
414
437
await task . onRun ( {
@@ -436,7 +459,15 @@ function stop (id, context) {
436
459
const task = findOne ( id , context )
437
460
if ( task && task . status === 'running' && task . child ) {
438
461
task . _terminating = true
439
- terminate ( task . child . pid )
462
+ try {
463
+ terminate ( task . child . pid )
464
+ } catch ( e ) {
465
+ console . error ( e )
466
+ updateOne ( {
467
+ id : task . id ,
468
+ status : 'terminated'
469
+ } , context )
470
+ }
440
471
}
441
472
return task
442
473
}
You can’t perform that action at this time.
0 commit comments