Skip to content

Commit 21e75fb

Browse files
author
Pete Bishop
committed
Windows support for path detection
1 parent 419b198 commit 21e75fb

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/Commands/DebugCommand.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ public function handle(): void
5252

5353
private function processEnvironment(): static
5454
{
55+
$locationCommand = 'which';
56+
57+
if (PHP_OS_FAMILY === 'Windows') {
58+
$locationCommand = 'where';
59+
}
60+
5561
info('Generating Environment Data...');
5662
$environment = [
5763
'PHP' => [
@@ -65,8 +71,11 @@ private function processEnvironment(): static
6571
],
6672
'Node' => [
6773
'Version' => trim(Process::run('node -v')->output()),
68-
'Path' => trim(Process::run('which node')->output()),
69-
'NPM' => trim(Process::run('npm -v')->output()),
74+
'Path' => trim(Process::run("$locationCommand node")->output()),
75+
],
76+
'NPM' => [
77+
'Version' => trim(Process::run('npm -v')->output()),
78+
'Path' => trim(Process::run("$locationCommand npm")->output()),
7079
],
7180
'OperatingSystem' => PHP_OS,
7281
];

0 commit comments

Comments
 (0)