Skip to content
This repository was archived by the owner on Dec 27, 2023. It is now read-only.

Commit 62de742

Browse files
committed
Implemented Windows check command exists
1 parent 9fd5c81 commit 62de742

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/System/WindowsSystem.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ public function getCurrentUserHome()
3939
*/
4040
public function checkIfCommandExists($cmdName)
4141
{
42-
return true;
42+
if (!function_exists('exec')) {
43+
return false;
44+
}
45+
46+
$sysResponse = exec("where $cmdName > nul 2>&1 && echo true");
47+
48+
return filter_var($sysResponse, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
4349
}
4450

4551
/** @return string */

0 commit comments

Comments
 (0)