Skip to content

Commit

Permalink
Update for latest Psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Jan 28, 2024
1 parent 6c711ee commit 466b5dc
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Internal/Posix/PosixHandle.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ static function (string $callbackId, $stream) use (&$status, $deferred, $stdin,
// Don't call proc_close here or close output streams, as there might still be stream reads
$stdin->get()?->close();

\fclose($stream);
if (\is_resource($stream)) {
\fclose($stream);
}

self::asyncWaitPid($shellPid);
},
Expand Down
1 change: 1 addition & 0 deletions src/Internal/Posix/PosixRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ static function (CancelledException $e) use ($suspension, $callbackId): void {
$cancellation->unsubscribe($cancellationId);
}

/** @psalm-suppress RiskyTruthyFalsyComparison */
$pid = \rtrim(\fgets($extraDataPipe) ?: '');
if (!$pid || !\is_numeric($pid)) {
\proc_terminate($proc);
Expand Down
2 changes: 2 additions & 0 deletions src/Internal/Windows/WindowsRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public function start(
});

try {
/** @psalm-suppress RiskyTruthyFalsyComparison */
$proc = \proc_open(
$this->makeCommand($workingDirectory ?? ''),
self::FD_SPEC,
Expand Down Expand Up @@ -113,6 +114,7 @@ public function start(

$cancellation->throwIfRequested();

/** @psalm-suppress RiskyTruthyFalsyComparison */
throw new ProcessException(\trim($message ?: 'Process did not connect to server before timeout elapsed'));
}

Expand Down
2 changes: 1 addition & 1 deletion src/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static function start(
? \implode(" ", \array_map(escapeArgument(...), $command))
: $command;

if (!$workingDirectory) {
if ($workingDirectory === null) {
$cwd = \getcwd();
if ($cwd === false) {
throw new ProcessException('Failed to determine current working directory');
Expand Down

0 comments on commit 466b5dc

Please sign in to comment.