File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -228,14 +228,16 @@ private function launchInspector(ConsoleIo $io): int
228228 */
229229 private function findExecutable (string $ name ): ?string
230230 {
231+ $ nullDevice = DIRECTORY_SEPARATOR === '\\' ? 'nul ' : '/dev/null ' ;
232+
231233 // Try which command first (Unix/Linux/macOS)
232- $ which = trim ((string )shell_exec (sprintf ('which %s 2>/dev/null ' , escapeshellarg ($ name ))));
234+ $ which = trim ((string )shell_exec (sprintf ('which %s 2>%s ' , escapeshellarg ($ name ), $ nullDevice )));
233235 if ($ which !== '' && is_executable ($ which )) {
234236 return $ which ;
235237 }
236238
237239 // Try where command (Windows)
238- $ where = trim ((string )shell_exec (sprintf ('where %s 2>nul ' , escapeshellarg ($ name ))));
240+ $ where = trim ((string )shell_exec (sprintf ('where %s 2>%s ' , escapeshellarg ($ name ), $ nullDevice )));
239241 if ($ where !== '' ) {
240242 $ paths = explode ("\n" , $ where );
241243 $ firstPath = trim ($ paths [0 ]);
You can’t perform that action at this time.
0 commit comments