Example #1
0
			})
		})

		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
		`)

			process, err := processTracker.Run("855", cmd, garden.ProcessIO{}, nil, nil)
			Expect(err).NotTo(HaveOccurred())