Expect(err).NotTo(HaveOccurred()) _, err = io.Stderr.Write([]byte("hi err")) Expect(err).NotTo(HaveOccurred()) return 34, nil } }) It("emits the output chunks as they come in", func() { Expect(stdoutBuffer).To(gbytes.Say("hi out")) Expect(stderrBuffer).To(gbytes.Say("hi err")) }) It("should flush the output when the code exits", func() { Expect(fakeStreamer.FlushCallCount()).To(Equal(1)) }) It("emits the exit status code", func() { Expect(stdoutBuffer).To(gbytes.Say("Exit status 34")) }) }) }) Describe("Cancel", func() { var ( performErr chan error waiting chan struct{} waitExited chan int )