Infection: Space in directory path breaks Infection

Created on 18 Jul 2018  路  4Comments  路  Source: infection/infection

| Question | Answer
| ------------| ---------------
| Infection version | 0.9.0 (infection.phar --version)
| Test Framework version | PHPUnit 7.2.7
| PHP version | 7.1.7 (php -v)
| Platform | MacOS
| Github Repo | -

The path to my directory where I want to run infection has got a space in it, and so the exec /Users/gary/Local Sites/long/path/to/my/phpunit --version fails.

Error Output:
  ================
  sh: /Users/gary/Local: No such file or directory
  sh: line 0: exec: /Users/gary/Local: cannot execute: No such file or directory
Bug Has PR

Most helpful comment

The same issue with the custom tmpDir as well.

I'd say that we can re-write getExecutableCommandLine https://github.com/infection/infection/blob/master/src/Process/Builder/ProcessBuilder.php#L60 and return an array of arguments instead of building the string.

With this approach symfony will escape all arguments on its side https://github.com/symfony/process/blob/v4.1.1/Process.php#L262

it may reduce our codebase in the AbstractTestFrameworkAdapter class

p.s. Think I can take a look on the next week.

All 4 comments

Thank you for reporting this issue to us.

I think an escapeshellarg with the testframework finder will do the trick

The same issue with the custom tmpDir as well.

I'd say that we can re-write getExecutableCommandLine https://github.com/infection/infection/blob/master/src/Process/Builder/ProcessBuilder.php#L60 and return an array of arguments instead of building the string.

With this approach symfony will escape all arguments on its side https://github.com/symfony/process/blob/v4.1.1/Process.php#L262

it may reduce our codebase in the AbstractTestFrameworkAdapter class

p.s. Think I can take a look on the next week.

:clap:

Was this page helpful?
0 / 5 - 0 ratings