reactphp / child-process

Event-driven library for executing child processes with ReactPHP.
https://reactphp.org/child-process/
MIT License
306 stars 45 forks source link

Don't replace generated command from \ to \\ #104

Closed samsonasik closed 11 months ago

samsonasik commented 1 year ago

Hi,

we are using this component for rector, currently, we currently have issue with spaced root project, that we have:

/Users/samsonasik/www/spaced prj sample/target/rector.php

and we want to change to:

/Users/samsonasik/www/spaced\ prj\ sample/target/rector.php

and this seems generaetd as double \\:

-/Users/samsonasik/www/spaced\ prj\ sample/target/rector.php
+/Users/samsonasik/www/spaced\\ prj\\ sample/target/rector.php

is this possible to be fixed here? Thank you.

SimonFrings commented 11 months ago

Hey @samsonasik, I don't think this is something coming from reactphp/child-process to be honest. This project is used to give commands to a child-processes which will then be executed by an underlying shell.

Taken from your conversation in https://github.com/rectorphp/rector-src/pull/4813, you're currently using escapeshellarg(), which escapes any additional backslashes as written in its documentation:

Furthermore, each streak of consecutive backslashes (\) is escaped by one additional backslash.

So it seems like this is something you have to configure in rector. I hope this helps to keep going.

I believe this should answer your question, so I will close this ticket. Happy to help if anything else comes up :+1:

samsonasik commented 11 months ago

@SimonFrings its fine, we currently handling with relative path, it works on windows (cmd,bash), except powershell.

We currently document the limitation at known drawback

https://github.com/rectorphp/rector-src/blob/main/build/target-repository/README.md#known-drawbacks