Skip to content

Commit

Permalink
fixed bug
Browse files Browse the repository at this point in the history
  • Loading branch information
atirtan committed Feb 10, 2020
1 parent 7f00427 commit f816a7d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Helpers/CommandLine.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct(string $command, ?string $workingDirectory, ?string
if ($stdOut === self::STDOUT_TO_DEV_NULL) {
$this->stdOut = ' > ' . $stdOut;
} elseif ($stdOut !== null) {
$this->stdOut = ' 2> ' . ' > ' . escapeshellarg($stdOut);
$this->stdOut = ' > ' . escapeshellarg($stdOut);
}
}

Expand Down
15 changes: 15 additions & 0 deletions test/Helpers/CommandLineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@ public function testSimpleCommandWithWorkingDirAndStdErrAndStdOut(): void
);
}

public function testSimpleCommandWithWorkingDirAndStdErrAndStdOutNonDefault(): void
{
$commandLine = new CommandLine(
'ls',
'/opt',
'/var/log/err',
'/var/log/out'
);

self::assertSame(
"cd '/opt' && ls 2> '/var/log/err' > '/var/log/out'",
$commandLine->getFullCommand()
);
}

public function testAdvancedCommandWithWorkingDirAndStdErrAndStdOut(): void
{
$commandLine = (new CommandLine(
Expand Down

0 comments on commit f816a7d

Please sign in to comment.