public static function Drush_TestCase::_escapeshellarg_windows

6.x drush_testcase.inc public static Drush_TestCase::_escapeshellarg_windows($arg)
4.x drush_testcase.inc public static Drush_TestCase::_escapeshellarg_windows($arg)
5.x drush_testcase.inc public static Drush_TestCase::_escapeshellarg_windows($arg)
1 call to Drush_TestCase::_escapeshellarg_windows()

File

tests/drush_testcase.inc, line 66

Class

Drush_TestCase

Code

public static function _escapeshellarg_windows($arg) {
  // Double up existing backslashes
  $arg = preg_replace('/\\\/', '\\\\\\\\', $arg);

  // Escape double quotes.
  $arg = preg_replace('/"/', '\\"', $arg);

  // Escape single quotes.
  $arg = preg_replace('/\'/', '\\\'', $arg);

  // Add surrounding quotes.
  $arg = '"' . $arg . '"';

  return $arg;
}