Exemplo n.º 1
0
				return process, nil
			}

			stdout := gbytes.NewBuffer()
			stderr := gbytes.NewBuffer()

			processIO := garden.ProcessIO{
				Stdout: stdout,
				Stderr: stderr,
			}

			process, err := container.Attach("process-handle", processIO)
			Ω(err).ShouldNot(HaveOccurred())

			attachedHandle, attachedID, attachedIO := fakeConnection.AttachArgsForCall(0)
			Ω(attachedHandle).Should(Equal("some-handle"))
			Ω(attachedID).Should(Equal("process-handle"))
			Ω(attachedIO).Should(Equal(processIO))

			Ω(process.ID()).Should(Equal("process-handle"))

			status, err := process.Wait()
			Ω(err).ShouldNot(HaveOccurred())
			Ω(status).Should(Equal(123))

			Eventually(stdout).Should(gbytes.Say("stdout data"))
			Eventually(stderr).Should(gbytes.Say("stderr data"))
		})
	})