Skip to content

Commit 14c6e89

Browse files
committed
Remove unneeded outputs from shell_exec
1 parent 807fe69 commit 14c6e89

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/Phug/Split/Command/CommandBase.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ protected function getCurrentLinkedCommitHash(): ?string
109109
*/
110110
protected function remove(string $fileOrDirectory): bool
111111
{
112+
if (!is_writable($fileOrDirectory)) {
113+
return false;
114+
}
115+
112116
@shell_exec('rm -rf '.escapeshellarg($fileOrDirectory).' 2>&1');
113117
file_exists($fileOrDirectory) && @shell_exec('rmdir /S /Q '.escapeshellarg($fileOrDirectory).' 2>&1');
114118

src/Phug/Split/Command/Dist.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,7 @@ protected function distributePackage(Split $cli, array $package, string $branch)
131131
$this->info($cli, ' => '.($branchRevision === '' ? 'no revision' : $branchRevision));
132132
$option = preg_match('/^[0-9a-f]+$/i', $branchRevision) ? '' : ' -b';
133133
$cli->writeLine("git checkout$option $branch", 'light_green');
134-
$cli->gray();
135-
$this->git("checkout$option $branch");
136-
$cli->discolor();
134+
$this->git("checkout$option $branch", [], '2>&1');
137135

138136
return true;
139137
}

tests/Phug/Command/DistTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function testRun()
101101
'done.',
102102
"#[0m#[1;34mcd {$path}dist/vendor/sub-package",
103103
'#[0m#[1;32mgit checkout master',
104-
"#[0m#[1;30m#[0m#[1;35mBuild distributed in {$path}dist",
104+
"#[0m#[1;35mBuild distributed in {$path}dist",
105105
'#[0m',
106106
]);
107107
$this->assertSame($expected, $output);

0 commit comments

Comments
 (0)