Skip to content

Commit d75e792

Browse files
committed
Check if current_path exist in run command
1 parent d864e72 commit d75e792

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Command/RunCommand.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
use Deployer\Deployer;
1111
use Deployer\Task\Context;
1212
use Deployer\Task\Task;
13-
use Symfony\Component\Console\Input\InputArgument;
1413
use Symfony\Component\Console\Input\InputInterface as Input;
1514
use Symfony\Component\Console\Input\InputOption as Option;
1615
use Symfony\Component\Console\Output\OutputInterface as Output;
1716
use function Deployer\cd;
1817
use function Deployer\get;
1918
use function Deployer\has;
2019
use function Deployer\run;
20+
use function Deployer\test;
2121
use function Deployer\writeln;
2222

2323
class RunCommand extends SelectCommand
@@ -58,7 +58,10 @@ protected function execute(Input $input, Output $output): int
5858

5959
$task = new Task($command, function () use ($command) {
6060
if (has('current_path')) {
61-
cd(get('current_path'));
61+
$path = get('current_path');
62+
if (test("[ -d $path ]")) {
63+
cd($path);
64+
}
6265
}
6366
$output = run($command);
6467
writeln($output);

0 commit comments

Comments
 (0)