Ejemplo n.º 1
0
				Expect(string((<-stream).Data)).To(Equal("goodbye\n"))
				Expect(*(<-stream).ExitStatus).To(Equal(uint32(42)))

				close(done)
			}, 10.0)
		})

		Context("and then sending a Stop request", func() {
			It("terminates all running processes", func() {
				_, stream, err := container.Run(warden.ProcessSpec{
					Script: `exec ruby -e 'trap("TERM") { exit 42 }; while true; sleep 1; end'`,
				})

				Expect(err).ToNot(HaveOccurred())

				err = container.Stop(false)
				Expect(err).ToNot(HaveOccurred())

				Expect(*(<-stream).ExitStatus).To(Equal(uint32(42)))
			})

			It("recursively terminates all child processes", func(done Done) {
				defer close(done)

				_, stream, err := container.Run(warden.ProcessSpec{
					Script: `
# don't die until child processes die
trap wait SIGTERM

# spawn child that exits when it receives TERM
bash -c 'sleep 100 & wait' &