return 1, io.EOF } stderrPipe.ReadStub = func(p []byte) (int, error) { defer GinkgoRecover() Eventually(fakeSecureSession.WaitCallCount).Should(Equal(1)) Consistently(sessionErrorCh).ShouldNot(Receive()) p[0] = 2 return 1, io.EOF } }) It("waits for the copies to complete", func() { Eventually(sessionErrorCh).Should(Receive()) Expect(stdoutPipe.ReadCallCount()).To(Equal(1)) Expect(stderrPipe.ReadCallCount()).To(Equal(1)) }) }) Context("when stdin is closed", func() { BeforeEach(func() { stdin.ReadStub = func(p []byte) (int, error) { defer GinkgoRecover() Consistently(stdinPipe.CloseCallCount).Should(Equal(0)) p[0] = 0 return 1, io.EOF } }) It("closes the stdinPipe", func() {