Eventually(stdout).Should(gbytes.Say("24 80")) }) }) }) Context("when spawning fails", func() { It("returns the error", func() { _, err := processTracker.Run(200, exec.Command("/bin/does-not-exist"), garden.ProcessIO{}, nil, signaller) Expect(err).To(HaveOccurred()) }) }) }) Describe("Restoring processes", func() { It("tracks the restored process", func() { processTracker.Restore(2, signaller) activeProcesses := processTracker.ActiveProcesses() Expect(activeProcesses).To(HaveLen(1)) Expect(activeProcesses[0].ID()).To(Equal(uint32(2))) }) }) Describe("Attaching to running processes", func() { It("streams stdout, stdin, and stderr", func() { cmd := exec.Command("bash", "-c", ` stuff=$(cat) echo "hi stdout" $stuff echo "hi stderr" $stuff >&2 `)
Eventually(stdout).Should(gbytes.Say("24 80")) }) }) }) Context("when spawning fails", func() { It("returns the error", func() { _, err := processTracker.Run("200", exec.Command("/bin/does-not-exist"), garden.ProcessIO{}, nil, nil) Expect(err).To(HaveOccurred()) }) }) }) Describe("Restoring processes", func() { It("tracks the restored process", func() { processTracker.Restore("2", nil) activeProcesses := processTracker.ActiveProcesses() Expect(activeProcesses).To(HaveLen(1)) Expect(activeProcesses[0].ID()).To(Equal("2")) }) }) Describe("Attaching to running processes", func() { It("streams stdout, stdin, and stderr", func() { cmd := exec.Command("bash", "-c", ` stuff=$(cat) echo "hi stdout" $stuff echo "hi stderr" $stuff >&2 `)
Eventually(stdout).Should(gbytes.Say("24 80")) }) }) }) Context("when spawning fails", func() { It("returns the error", func() { _, err := processTracker.Run("200", exec.Command("/bin/does-not-exist"), garden.ProcessIO{}, nil) Expect(err).To(HaveOccurred()) }) }) }) Describe("Restoring processes", func() { It("tracks the restored process", func() { processTracker.Restore("2") activeProcesses := processTracker.ActiveProcesses() Expect(activeProcesses).To(HaveLen(1)) Expect(activeProcesses[0].ID()).To(Equal("2")) }) }) Describe("Attaching to running processes", func() { It("streams stdout, stdin, and stderr", func() { cmd := exec.Command("bash", "-c", ` stuff=$(cat) echo "hi stdout" $stuff echo "hi stderr" $stuff >&2 `)