Пример #1
0
				ptyOpener.OpenReturns(theOpenedPTY, theOpenedTTY, nil)
			})

			It("attaches a tty to the process's stdin, out and error", func() {
				Expect(cmd.Stdin).To(Equal(theOpenedTTY))
				Expect(cmd.Stdout).To(Equal(theOpenedTTY))
				Expect(cmd.Stderr).To(Equal(theOpenedTTY))
			})

			It("returns the pty", func() {
				Expect(returnedFds[0]).To(Equal(theOpenedPTY))
			})

			It("waits for the exit status", func() {
				Eventually(runner.WaitCallCount).Should(Equal(1))
				Expect(runner.WaitArgsForCall(0)).To(Equal(cmd))
			})

			It("tells the command to start with a controlling tty and session id", func() {
				Expect(cmd.SysProcAttr.Setctty).To(Equal(true))
				Expect(cmd.SysProcAttr.Setsid).To(Equal(true))
			})

			Context("when sysprocattr is already set", func() {
				BeforeEach(func() {
					cmd.SysProcAttr = &syscall.SysProcAttr{
						Ptrace: true,
					}
				})

				It("does not clobber it", func() {