@@ -440,6 +440,7 @@ enum PlaygroundMessage {
440
440
Response ( WSResponse ) ,
441
441
StdoutPacket ( String ) ,
442
442
StderrPacket ( String ) ,
443
+ StreamFailure ,
443
444
}
444
445
445
446
#[ derive( Debug , serde:: Serialize , serde:: Deserialize ) ]
@@ -460,14 +461,14 @@ impl From<(JobReport, serde_json::Value, ResponseKind)> for WSResponse {
460
461
ResponseKind :: Compile => {
461
462
let mut success = false ;
462
463
let mut code = String :: new ( ) ;
463
- if let Some ( Response :: ReadFile ( ReadFileResponse ( Ok ( data) ) ) ) = responses. last ( ) {
464
+ if let Some ( ResponseResult ( Ok ( Response :: ReadFile ( ReadFileResponse ( data) ) ) ) ) = responses. last ( ) {
464
465
success = true ;
465
466
code = std:: str:: from_utf8 ( data) . unwrap ( ) . to_owned ( ) ;
466
467
}
467
468
let mut stdout = String :: new ( ) ;
468
469
let mut stderr = String :: new ( ) ;
469
470
if responses. len ( ) >= 3 {
470
- if let Some ( Response :: ExecuteCommand ( ExecuteCommandResponse ( Ok ( output) ) ) ) =
471
+ if let Some ( ResponseResult ( Ok ( Response :: ExecuteCommand ( ExecuteCommandResponse ( output) ) ) ) ) =
471
472
responses. get ( 2 )
472
473
{
473
474
stdout = from_utf8 ( & output. stdout ) . unwrap ( ) . to_owned ( ) ;
@@ -485,14 +486,14 @@ impl From<(JobReport, serde_json::Value, ResponseKind)> for WSResponse {
485
486
ResponseKind :: Format => {
486
487
let mut success = false ;
487
488
let mut code = String :: new ( ) ;
488
- if let Some ( Response :: ReadFile ( ReadFileResponse ( Ok ( data) ) ) ) = responses. last ( ) {
489
+ if let Some ( ResponseResult ( Ok ( Response :: ReadFile ( ReadFileResponse ( data) ) ) ) ) = responses. last ( ) {
489
490
success = true ;
490
491
code = std:: str:: from_utf8 ( data) . unwrap ( ) . to_owned ( ) ;
491
492
}
492
493
let mut stdout = String :: new ( ) ;
493
494
let mut stderr = String :: new ( ) ;
494
495
if responses. len ( ) >= 3 {
495
- if let Some ( Response :: ExecuteCommand ( ExecuteCommandResponse ( Ok ( output) ) ) ) =
496
+ if let Some ( ResponseResult ( Ok ( Response :: ExecuteCommand ( ExecuteCommandResponse ( output) ) ) ) ) =
496
497
responses. get ( 2 )
497
498
{
498
499
stdout = from_utf8 ( & output. stdout ) . unwrap ( ) . to_owned ( ) ;
@@ -508,8 +509,8 @@ impl From<(JobReport, serde_json::Value, ResponseKind)> for WSResponse {
508
509
} )
509
510
}
510
511
ResponseKind :: Execute => {
511
- let success = if let Some ( Response :: StreamCommand ( resp) ) = responses. last ( ) {
512
- resp. 0 . is_ok ( )
512
+ let success = if let Some ( ResponseResult ( resp) ) = responses. last ( ) {
513
+ resp. is_ok ( )
513
514
} else {
514
515
false
515
516
} ;
@@ -648,6 +649,9 @@ async fn pair_websocket_worker(
648
649
WorkerMessage :: StderrPacket ( packet) => {
649
650
ws_sender. send( serde_json:: to_string( & PlaygroundMessage :: StderrPacket ( packet) ) . expect( "Failed to serilaze standard output" ) ) . await . expect( "Websocket failed to send standard output to client" ) ;
650
651
}
652
+ WorkerMessage :: StreamFailure => {
653
+ ws_sender. send( serde_json:: to_string( & PlaygroundMessage :: StreamFailure ) . expect( "Failed to serilize streaming failure notification" ) ) . await . expect( "Websocket failed to send streaming failure notification" ) ;
654
+ }
651
655
}
652
656
}
653
657
}
0 commit comments