Ejemplo n.º 1
0
		BeforeEach(func() {
			process.Spec.TTY = &garden.TTYSpec{}
		})

		It("makes stdin a raw terminal (because the remote terminal will handle echoing etc.)", func() {
			socketConnector.ConnectReturns([]unix_socket.Fd{FakeFd(0), FakeFd(0)}, 0, nil)

			Expect(process.Start()).To(Succeed())
			Expect(fakeTerm.SetRawTerminalCallCount()).To(Equal(1))
		})

		It("restores the terminal state when the process is cleaned up", func() {
			socketConnector.ConnectReturns([]unix_socket.Fd{FakeFd(0), FakeFd(0)}, 0, nil)

			state := &term.State{}
			fakeTerm.SetRawTerminalReturns(state, nil)

			Expect(process.Start()).To(Succeed())
			Expect(fakeTerm.RestoreTerminalCallCount()).To(Equal(0))

			process.Cleanup()
			Expect(fakeTerm.RestoreTerminalCallCount()).To(Equal(1))
			fd, state := fakeTerm.RestoreTerminalArgsForCall(0)
			Expect(fd).To(Equal(os.Stdin.Fd()))
			Expect(state).To(Equal(state))
		})

		It("sets the window size of the process based on the window size of standard input", func() {
			remotePty := FakeFd(123)
			socketConnector.ConnectReturns([]unix_socket.Fd{remotePty, FakeFd(999)}, 0, nil)
			fakeTerm.GetWinsizeReturns(&term.Winsize{