Skip to content

Command gh not found on Windows - #1895

Open
sertxudev wants to merge 2 commits into
pestphp:5.xfrom
sertxudev:fix/gh-not-found-on-windows
Open

Command gh not found on Windows#1895
sertxudev wants to merge 2 commits into
pestphp:5.xfrom
sertxudev:fix/gh-not-found-on-windows

Conversation

@sertxudev

Copy link
Copy Markdown

What:

  • Bug Fix
  • New Feature

Description:

When running the TIA engine on Windows, the gh command is not detected because which gh only works on Unix-based OS.

For Windows, we have to use where gh.

Comment thread src/Plugins/Tia/BaselineSync.php Outdated
private function commandExists(string $cmd): bool
{
$process = new Process(['which', $cmd]);
if (PHP_OS_FAMILY === 'Windows') {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to use (new \Symfony\Component\Process\ExecutableFinder())->find('gh'); here? 👀

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MrPunyapal tomorrow morning I'll try it!

Signed-off-by: Sergio Peris <22801379+sertxudev@users.noreply.github.com>
@sertxudev

Copy link
Copy Markdown
Author

Hi @MrPunyapal . I've updated the code so we now use the find method from Symfony\Component\Process\ExecutableFinder as proposed. This method returns the command path if it exists, or null if it doesn't.

We're checking whether the command exists, so it makes sense to check that the output is not null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants