Ejemplo n.º 1
0
	Describe("Non Interactively (without a tty)", func() {
		var (
			cmdStdin io.Reader
		)

		BeforeEach(func() {
			withTty = false
		})

		Context("when starting the process succeeds", func() {
			BeforeEach(func() {
				cmd = exec.Command("foo")
				runner.StartStub = func(cmd *exec.Cmd) error {
					cmd.Stdout.Write([]byte("Banana doo"))
					cmd.Stderr.Write([]byte("Banana goo"))
					cmdStdin = cmd.Stdin

					return nil
				}
			})

			It("returns the streams from the spawned process", func() {
				Expect(checkReaderContent(returnedFds[1], "Banana doo")).To(BeTrue())
				Expect(checkReaderContent(returnedFds[2], "Banana goo")).To(BeTrue())

				returnedFds[0].Write([]byte("the stdin"))
				returnedFds[0].Close()
				Expect(checkReaderContent(cmdStdin, "the stdin")).To(BeTrue())
			})

			It("waits for the exit status", func() {