Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix proc_open_compat util on Windows #5689

Merged
merged 1 commit into from
Oct 28, 2022
Merged

Fix proc_open_compat util on Windows #5689

merged 1 commit into from
Oct 28, 2022

Conversation

lipemat
Copy link
Contributor

@lipemat lipemat commented Oct 14, 2022

Wrapping the commands in double quotes conflicts with various flags also using double quotes.

For example when running db export you get.

Warning: Failed to get current character set of the posts table. Reason: '"mysql --no-defaults --no-auto-rehash --batch --skip-column-names --host="localhost" --user="mat" --default-ch aracter-set="utf8" --execute="SELECT' is not recognized as an internal or external command, operable program or batch file.

Removing the quotes resolves the issue.

Wrapping the commands in double quotes conflicts with various flags also using double quotes. 

For example when running `db export` you get.

`Warning: Failed to get current character set of the posts table. Reason: '"mysql --no-defaults --no-auto-rehash --batch --skip-column-names --host="localhost" --user="mat" --default-ch
aracter-set="utf8" --execute="SELECT' is not recognized as an internal or external command,
operable program or batch file.`

Removing the quotes resolves the issue.
@cjhaas
Copy link

cjhaas commented Oct 17, 2022

Since proc_open supports environment variables as the fifth parameter for all platforms, would removing the is_windows() check and using (and renaming) _proc_open_compat_win_env be an option for everyone?

@lipemat
Copy link
Contributor Author

lipemat commented Oct 17, 2022

Since proc_open supports environment variables as the fifth parameter for all platforms, would removing the is_windows() check and using (and renaming) _proc_open_compat_win_env be an option for everyone?

Yes. I am open to this pattern.

@cjhaas
Copy link

cjhaas commented Oct 17, 2022

proc_open_compat was added in #4572, which also included some unit tests . As far as I can tell, those tests run regardless of platform, so presumably they've been passing for years now. There would be a tiny bit of overhead by doing this, technically, but I think it would be negligible in grander scheme of things.

If I get a chance I might try to make that change and get the tests to run, although it would be great if someone more familiar with running all the tests could do this instead.

Copy link
Member

@danielbachhuber danielbachhuber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @lipemat !

Landing so we can let it soak and see if any issues come up: #5521 (comment)

@danielbachhuber danielbachhuber changed the title Fix proc_open commands on Windows Fix proc_open_compat util on Windows Oct 28, 2022
@danielbachhuber danielbachhuber merged commit 2c7bd19 into wp-cli:master Oct 28, 2022
@lipemat lipemat deleted the fix-windows-commands branch February 24, 2023 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants