Skip to content

Commit

Permalink
refactor(concerns): update shouldApplySudoPassword logic
Browse files Browse the repository at this point in the history
- Return true only if sudoPassword is set and OS is Unix
- Exclude 'cli' and 'phpdbg' SAPIs
  • Loading branch information
guanguans committed Jul 14, 2023
1 parent c7daecd commit d205948
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Concerns/HasSudoPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function setSudoPassword(?string $sudoPassword): self

protected function shouldApplySudoPassword(): bool
{
return OS::isUnix() && $this->sudoPassword;
return $this->sudoPassword && OS::isUnix() && (\PHP_SAPI !== 'cli' && \PHP_SAPI !== 'phpdbg');
}

protected function getEscapeSudoPassword(): string
Expand Down

0 comments on commit d205948

Please sign in to comment.