It("executes given command", func() {
			_, err := runner.RunCommand("fake-log-dir-name", "fake-log-file-name", cmd)
			Expect(err).ToNot(HaveOccurred())

			Expect(cmdRunner.RunComplexCommands).To(HaveLen(1))

			actualCmd := cmdRunner.RunComplexCommands[0]
			Expect(actualCmd.Name).To(Equal("fake-cmd"))
			Expect(actualCmd.Args).To(Equal([]string{"fake-args"}))
			Expect(actualCmd.Env).To(Equal(map[string]string{"fake-env-key": "fake-env-var"}))
			Expect(actualCmd.WorkingDir).To(Equal("/fake-working-dir"))
		})

		It("returns an error if it fails to save output", func() {
			fs.OpenFileErr = errors.New("fake-open-file-error")

			_, err := runner.RunCommand("fake-log-dir-name", "fake-log-file-name", cmd)
			Expect(err).To(HaveOccurred())
			Expect(err.Error()).To(ContainSubstring("fake-open-file-error"))
		})

		Context("when command succeeds", func() {
			BeforeEach(func() {
				cmdRunner.AddCmdResult("fake-cmd fake-args", fakesys.FakeCmdResult{
					Stdout:     "fake-stdout",
					Stderr:     "fake-stderr",
					ExitStatus: 0,
				})
			})