Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e9fd416

Browse files
committed
up: update some for cmd build and run
1 parent cb7f01b commit e9fd416

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

‎src/Cmd/AbstractCmdBuilder.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
namespace Toolkit\Sys\Cmd;
1111

1212
use RuntimeException;
13+
use Toolkit\Stdlib\Helper\Assert;
1314
use Toolkit\Stdlib\Str;
1415
use Toolkit\Sys\Exec;
1516
use function trim;
@@ -141,6 +142,10 @@ protected function innerExecute(string $command, string $workDir): void
141142
$this->printMessage("> $command", self::PRINT_CMD);
142143
}
143144

145+
if ($workDir) {
146+
Assert::isDir($workDir, "workdir is not exists. path: $workDir");
147+
}
148+
144149
if ($this->dryRun) {
145150
$this->output = 'DRY-RUN: Command execute success';
146151
// Color::println($output, 'cyan');

‎src/Cmd/CmdBuilder.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
namespace Toolkit\Sys\Cmd;
1111

12-
use Toolkit\Stdlib\Helper\Assert;
1312
use Toolkit\Stdlib\Str;
1413
use function sprintf;
1514

@@ -164,10 +163,6 @@ public function run(bool $printOutput = false): static
164163
{
165164
$this->printOutput = $printOutput;
166165

167-
if ($workDir = $this->workDir) {
168-
Assert::isDir($workDir, "workdir is not exists. path: $workDir");
169-
}
170-
171166
$command = $this->buildCommandLine();
172167
$this->innerExecute($command, $this->workDir);
173168

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /