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

Add support for absolute paths in Bloopgun error handling #2132

Merged
merged 4 commits into from
Sep 26, 2023

Conversation

andrzejressel
Copy link
Contributor

On Windows with scala-cli I got something like:

java.io.IOException: Cannot run program "C:\Program Files\Microsoft\jdk-17.0.7.7-hotspot\bin\java" (in directory "d:\MojeProgramy\bloop-core"): CreateProcess error=2, Nie mo?na odnale?? okre?lonego pliku

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

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

LGTM!

@tgodzik
Copy link
Contributor

tgodzik commented Aug 18, 2023

Ach, I know remember why I didn't merge it. Could you run formatting? I totally forgot about it, sorry!

@tgodzik
Copy link
Contributor

tgodzik commented Aug 21, 2023

Interestingly enough one of the tests now fails (though not on windows) and I don't think there is a way to make if pass if there is any java available 🤔

However, I think that is fine, though we would need to adjust the tests and see if the error on windows is different and maybe regex needs adjusting? @andrzejressel do you have time to look into that?

@andrzejressel
Copy link
Contributor Author

I would argue that test is wrong (and Windows setup). The exception thrown is:

java.io.IOException: Cannot run program "does-not-exist/bin/java" (in directory "/tmp/cwd-test1220557323768451443"): error=2, No such file or directorycherTest / Test / executeTests 11s
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
        at bloop.bloopgun.BloopgunCli.sysproc$1(Bloopgun.scala:487)
        at bloop.bloopgun.BloopgunCli.sysprocWithJava$1(Bloopgun.scala:502)
        at bloop.bloopgun.BloopgunCli.startServer(Bloopgun.scala:549)
        at bloop.bloopgun.BloopgunCli$FireInBackground$.$anonfun$fire$1(Bloopgun.scala:314)
        at bloop.bloopgun.core.Shell$$anon$2.run(Shell.scala:154)
Caused by: java.io.IOException: error=2, No such file or directory
        at java.lang.UNIXProcess.forkAndExec(Native Method)
        at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
        at java.lang.ProcessImpl.start(ProcessImpl.java:134)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
        ... 5 more

That means that bloop is supposed to run - after all we do all the JAVA_HOME finding stuff. It was working fine incorrectly earlier because of matching.

The issue with Windows runner is that it's not setting JAVA_HOME:
image

@andrzejressel
Copy link
Contributor Author

Also that .map(Paths.get(_).resolve("bin/java")) - unix only stuff

@andrzejressel
Copy link
Contributor Author

Should be fine now

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

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

LGTM!

@tgodzik tgodzik merged commit daae034 into scalacenter:main Sep 26, 2023
16 of 17 checks passed
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.

2 participants