@@ 415-435 (lines=21) @@ | ||
412 | * |
|
413 | * @return string|bool The valid shell name, false in case no valid shell is found |
|
414 | */ |
|
415 | private function getShell() |
|
416 | { |
|
417 | if (null !== self::$shell) { |
|
418 | return self::$shell; |
|
419 | } |
|
420 | ||
421 | self::$shell = false; |
|
422 | ||
423 | if (file_exists('/usr/bin/env')) { |
|
424 | // handle other OSs with bash/zsh/ksh/csh if available to hide the answer |
|
425 | $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null"; |
|
426 | foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) { |
|
427 | if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) { |
|
428 | self::$shell = $sh; |
|
429 | break; |
|
430 | } |
|
431 | } |
|
432 | } |
|
433 | ||
434 | return self::$shell; |
|
435 | } |
|
436 | ||
437 | private function hasSttyAvailable() |
|
438 | { |
@@ 381-401 (lines=21) @@ | ||
378 | * |
|
379 | * @return string|bool The valid shell name, false in case no valid shell is found |
|
380 | */ |
|
381 | private function getShell() |
|
382 | { |
|
383 | if (null !== self::$shell) { |
|
384 | return self::$shell; |
|
385 | } |
|
386 | ||
387 | self::$shell = false; |
|
388 | ||
389 | if (file_exists('/usr/bin/env')) { |
|
390 | // handle other OSs with bash/zsh/ksh/csh if available to hide the answer |
|
391 | $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null"; |
|
392 | foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) { |
|
393 | if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) { |
|
394 | self::$shell = $sh; |
|
395 | break; |
|
396 | } |
|
397 | } |
|
398 | } |
|
399 | ||
400 | return self::$shell; |
|
401 | } |
|
402 | ||
403 | /** |
|
404 | * Returns whether Stty is available or not. |