File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -56,15 +56,30 @@ public function successful(): bool
56
56
return $ this ->isSuccessful ;
57
57
}
58
58
59
- protected function findBinary (string $ binary )
59
+ protected function findBinary (string $ binary ): string
60
60
{
61
61
if (\is_executable ($ binary )) {
62
- return $ binary ;
62
+ return ' " ' . $ binary . ' " ' ;
63
63
}
64
64
65
- $ finder = new ExecutableFinder () ;
65
+ $ isWin = \ DIRECTORY_SEPARATOR === '\\' ;
66
66
67
- return $ finder ->find ($ binary ) ?: $ binary ;
67
+ return $ isWin ? $ this ->findWindowsBinary ($ binary ) : '" ' . $ binary . '" ' ;
68
+ }
69
+
70
+ protected function findWindowsBinary (string $ binary ): string
71
+ {
72
+ $ paths = \explode (\PATH_SEPARATOR , \getenv ('PATH ' ) ?: \getenv ('Path ' ));
73
+
74
+ foreach ($ paths as $ path ) {
75
+ foreach (['.exe ' , '.bat ' , '.cmd ' ] as $ ext ) {
76
+ if (\is_file ($ file = $ path . '\\' . $ binary . $ ext )) {
77
+ return '" ' . $ file . '" ' ;
78
+ }
79
+ }
80
+ }
81
+
82
+ return '" ' . $ binary . '" ' ;
68
83
}
69
84
70
85
/**
You can’t perform that action at this time.
0 commit comments