Skip to content
Browse files

MDL-34885 phpunit: better cygwin detection.

For some reason, on my computer, $_SERVER['SHELL'] was not set, so I
changed the test to also consider $_SERVER['TERM']. This now works for
me.
  • Loading branch information...
1 parent e6aac11 commit ba338db5b54eb2081d72255b2205e9c2bad33725 @timhunt timhunt committed Aug 14, 2012
Showing with 10 additions and 2 deletions.
  1. +10 −2 lib/phpunit/bootstraplib.php
View
12 lib/phpunit/bootstraplib.php
@@ -150,8 +150,16 @@ function phpunit_boostrap_fix_file_permissions($file) {
* @return bool
*/
function phpunit_bootstrap_is_cygwin() {
- if (empty($_SERVER['SHELL']) or empty($_SERVER['OS'])) {
+ if (empty($_SERVER['OS']) or $_SERVER['OS'] !== 'Windows_NT') {
+ return false;
+
+ } else if (!empty($_SERVER['SHELL']) and $_SERVER['SHELL'] === '/bin/bash') {
+ return true;
+
+ } else if (!empty($_SERVER['TERM']) and $_SERVER['TERM'] === 'cygwin') {
+ return true;
+
+ } else {
return false;
}
- return ($_SERVER['OS'] === 'Windows_NT' and $_SERVER['SHELL'] === '/bin/bash');
}

0 comments on commit ba338db

Please sign in to comment.
Something went wrong with that request. Please try again.