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

bugfix: Fix running when spaces are involved on windows #4815

Merged
merged 2 commits into from Jan 6, 2023

Conversation

tgodzik
Copy link
Contributor

@tgodzik tgodzik commented Jan 5, 2023

Previously, we would not escape Java path, classpath or java properties, which meant that whenever spaces were involved things would not work on Windows (possibly on some other systems too). Now, we properly escape all those things.

I tested both by hand and added a test case, which proved to be a pain to write :/

Fixes #4801

.replace("\\\"", "")
.replace("\"\\", "\\")
// when testing on Windows Program Files is problematic when splitting into list
.replace("Program Files", "ProgramFiles")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am so very sorry about this :O

Copy link
Member

Choose a reason for hiding this comment

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

Woof

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The other option would be to find a process runner that takes in a whole string, but that seems even more work :/

Previously, we would not escape Java path, classpath or java properties, which meant that whenever spaces were involved things would not work on Windows (possibly on some other systems too). Now, we properly escape all those things.

I tested both by hand and added a test case, which proved to be a pain to write :/

Fixes scalameta#4801
@tgodzik tgodzik marked this pull request as ready for review January 5, 2023 12:26
Copy link
Member

@ckipp01 ckipp01 left a comment

Choose a reason for hiding this comment

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

I mean, we have tests, so I feel ok about this, but I wish there was an easy way to give any sort of path to a function and have it make it safe for windows.

Either way with the tests and your manual testing, LGTM.

.replace("\\\"", "")
.replace("\"\\", "\\")
// when testing on Windows Program Files is problematic when splitting into list
.replace("Program Files", "ProgramFiles")
Copy link
Member

Choose a reason for hiding this comment

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

Woof

…dScalaMainClass.scala

Co-authored-by: Chris Kipp <ckipp@pm.me>
@tgodzik tgodzik merged commit eee6421 into scalameta:main Jan 6, 2023
@tgodzik tgodzik deleted the fix-running-windows branch January 6, 2023 13:52
@ScalaWilliam
Copy link

It's really fantastic to see Windows issues being handled so quickly 👏 !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot Identify File Path which contains a folder whose name have a space there
3 participants