process.WaitStub = func() (int, error) { writing.Wait() return 123, nil } return process, nil } }) It("streams stderr and stdout and exit status", func() { stdout := gbytes.NewBuffer() stderr := gbytes.NewBuffer() process, err := container.Attach(1, garden.ProcessIO{ Stdout: stdout, Stderr: stderr, }) Expect(err).ToNot(HaveOccurred()) pid, _ := fakeProcessTracker.AttachArgsForCall(0) Expect(pid).To(Equal(uint32(1))) Expect(process.ID()).To(Equal(uint32(42))) Eventually(stdout).Should(gbytes.Say("hi out\n")) Eventually(stderr).Should(gbytes.Say("hi err\n")) Expect(process.Wait()).To(Equal(123)) }) })