Esempio n. 1
0
			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())))

			Expect(fakeTerm.SetWinsizeCallCount()).To(Equal(1))
			fd, size := fakeTerm.SetWinsizeArgsForCall(0)
			Expect(fd).To(Equal(uintptr(123)))
			Expect(size).To(Equal(&term.Winsize{
				Width: 1, Height: 2,
			}))
		})

		Context("when SIGWINCH is received", func() {
			It("resizes the pty to match the window size of stdin", func() {
				remotePty := FakeFd(123)
				socketConnector.ConnectReturns([]unix_socket.Fd{remotePty, FakeFd(999)}, 0, nil)

				fakeTerm.GetWinsizeReturns(&term.Winsize{
					Width: 3, Height: 4,
				}, nil)
Esempio n. 2
0
		It("sets the window size of the process based on the window size of standard input", func() {
			remotePty := FakeFd(123)
			response.Files = []container_daemon.StreamingFile{remotePty, FakeFd(999)}
			response.Pid = 0

			socketConnector.ConnectReturns(response, 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())))

			Expect(fakeTerm.SetWinsizeCallCount()).To(Equal(1))
			fd, size := fakeTerm.SetWinsizeArgsForCall(0)
			Expect(fd).To(Equal(uintptr(123)))
			Expect(size).To(Equal(&term.Winsize{
				Width: 1, Height: 2,
			}))
		})

		Context("when SIGWINCH is received", func() {
			It("resizes the pty to match the window size of stdin", func() {
				remotePty := FakeFd(123)
				response.Files = []container_daemon.StreamingFile{remotePty, FakeFd(999)}
				response.Pid = 0

				socketConnector.ConnectReturns(response, nil)