File tree Expand file tree Collapse file tree 2 files changed +14
-11
lines changed
Expand file tree Collapse file tree 2 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -536,7 +536,7 @@ func (wgoCmd *WgoCmd) Run() error {
536536 case <- wgoCmd .ctx .Done ():
537537 stop (cmd )
538538 <- waitDone
539- return nil
539+ return wgoCmd . ctx . Err ()
540540 case err := <- cmdResult :
541541 if i == len (wgoCmd .ArgsList )- 1 {
542542 if wgoCmd .Exit {
Original file line number Diff line number Diff line change @@ -588,12 +588,11 @@ func TestWgoCmd_Run(t *testing.T) {
588588 wgoCmd .Stdout = buf
589589 err = wgoCmd .Run ()
590590 if err != nil {
591- t .Fatal (err )
592- }
593- got := strings .TrimSpace (buf .String ())
594- want := ""
595- if got != want {
596- t .Errorf ("\n got: %q\n want: %q" , got , want )
591+ if ! errors .Is (err , context .DeadlineExceeded ) {
592+ t .Fatal (err )
593+ }
594+ } else {
595+ t .Errorf ("\n got: nil error\n want: context.DeadlineExceeded" )
597596 }
598597 })
599598
@@ -611,7 +610,9 @@ func TestWgoCmd_Run(t *testing.T) {
611610 wgoCmd .Stdout = buf
612611 err = wgoCmd .Run ()
613612 if err != nil {
614- t .Fatal (err )
613+ if ! errors .Is (err , context .DeadlineExceeded ) {
614+ t .Fatal (err )
615+ }
615616 }
616617 got := strings .TrimSpace (buf .String ())
617618 want := "Waiting..."
@@ -660,7 +661,9 @@ func TestWgoCmd_Run(t *testing.T) {
660661 wgoCmd .Stdout = buf
661662 err = wgoCmd .Run ()
662663 if err != nil {
663- t .Fatal (err )
664+ if ! errors .Is (err , context .DeadlineExceeded ) {
665+ t .Fatal (err )
666+ }
664667 }
665668 got := strings .TrimSpace (buf .String ())
666669 want := "hello"
@@ -749,7 +752,7 @@ func TestWgoCmd_FileEvent(t *testing.T) {
749752
750753 cancel ()
751754 err = <- cmdResult
752- if err != nil {
755+ if err != nil && ! errors . Is ( err , context . Canceled ) {
753756 t .Fatal (err )
754757 }
755758 got := strings .TrimSpace (buf .String ())
@@ -831,7 +834,7 @@ func TestWgoCmd_Polling(t *testing.T) {
831834
832835 cancel ()
833836 err = <- cmdResult
834- if err != nil {
837+ if err != nil && ! errors . Is ( err , context . Canceled ) {
835838 t .Fatal (err )
836839 }
837840 got := strings .TrimSpace (buf .String ())
You can’t perform that action at this time.
0 commit comments