Example #1
0
				process, err := processTracker.Run("60", exec.Command("cat"), garden.ProcessIO{
					Stdin:  pipeR,
					Stdout: stdout,
				}, nil, nil)
				Expect(err).NotTo(HaveOccurred())

				pipeW.Write([]byte("Hello stdin!"))
				Eventually(stdout).Should(gbytes.Say("Hello stdin!"))

				pipeW.CloseWithError(errors.New("Failed"))
				Consistently(stdout, 0.1).ShouldNot(gbytes.Say("."))

				pipeR, pipeW = io.Pipe()
				processTracker.Attach(process.ID(), garden.ProcessIO{
					Stdin: pipeR,
				})

				pipeW.Write([]byte("Hello again, stdin!"))
				Eventually(stdout).Should(gbytes.Say("Hello again, stdin!"))

				pipeW.Close()
				exitStatus, err := process.Wait()
				Expect(err).ToNot(HaveOccurred())
				Expect(exitStatus).To(Equal(0))
			})

			It("supports attaching more than once", func() {
				pipeR, pipeW := io.Pipe()
				stdout := gbytes.NewBuffer()