Expect(err).To(HaveOccurred()) exitErr, ok := err.(*ssh.ExitError) Expect(ok).To(BeTrue()) Expect(exitErr.ExitStatus()).To(Equal(1)) }) }) Describe("the shell locator", func() { BeforeEach(func() { err := session.Run("true") Expect(err).NotTo(HaveOccurred()) }) It("uses the shell locator to find the default shell path", func() { Expect(shellLocator.ShellPathCallCount()).To(Equal(1)) cmd := runner.StartArgsForCall(0) Expect(cmd.Path).To(Equal("/bin/sh")) }) }) Context("when stdin is provided by the client", func() { BeforeEach(func() { session.Stdin = strings.NewReader("Hello") }) It("can use the session to execute a command that reads it", func() { result, err := session.Output("cat") Expect(err).NotTo(HaveOccurred()) Expect(string(result)).To(Equal("Hello"))