Skip to content

Commit

Permalink
Set "cancelled" in state bag to true if cancelled request received
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Jun 4, 2013
1 parent d2e4ba5 commit 3b56a27
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions basic_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ StepLoop:
// and just exit the loop now.
select {
case doneCh = <-b.cancelCh:
state["cancelled"] = true
break StepLoop
default:
}
Expand Down
6 changes: 6 additions & 0 deletions basic_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,10 @@ func TestBasicRunner_Cancel(t *testing.T) {
if !reflect.DeepEqual(results, expected) {
t.Errorf("unexpected result: %#v", results)
}

// Test that it says it is cancelled
cancelled := data["cancelled"].(bool)
if !cancelled {
t.Errorf("not cancelled")
}
}

0 comments on commit 3b56a27

Please sign in to comment.