MDL-43461 behat: Using linux-style directory separators when using cygwin

This commit is contained in:
David Monllao
2014-01-14 13:10:40 +08:00
parent 8a0667a994
commit 19a40b1468
3 changed files with 39 additions and 8 deletions
+18 -2
View File
@@ -66,10 +66,26 @@ class behat_command {
/**
* Returns the executable path
*
* Allows returning a customized command for cygwin when the
* command is just displayed, when using exec(), system() and
* friends we stay with DIRECTORY_SEPARATOR as they use the
* normal cmd.exe (in Windows).
*
* @param bool $custombyterm If the provided command should depend on the terminal where it runs
* @return string
*/
public final static function get_behat_command() {
return 'vendor' . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'behat';
public final static function get_behat_command($custombyterm = false) {
$separator = DIRECTORY_SEPARATOR;
$exec = 'behat';
// Cygwin uses linux-style directory separators.
if ($custombyterm && testing_is_cygwin()) {
$exec = 'behat.bat';
$separator = '/';
}
return 'vendor' . $separator . 'bin' . $separator . $exec;
}
/**