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{ Width: 1, Height: 2, }, nil) Expect(process.Start()).To(Succeed()) Expect(fakeTerm.GetWinsizeCallCount()).To(Equal(1)) Expect(fakeTerm.GetWinsizeArgsForCall(0)).To(Equal(uintptr(os.Stdin.Fd())))