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

Disable warnings logged by nuprocess library #798

Merged
merged 1 commit into from
Jan 16, 2019
Merged

Disable warnings logged by nuprocess library #798

merged 1 commit into from
Jan 16, 2019

Conversation

mzarnowski
Copy link
Contributor

When running launcher and bloop is not on the PATH we get the following error:

Starting the bsp launcher for bloop...
Jan 15, 2019 12:39:19 PM com.zaxxer.nuprocess.linux.LinuxProcess start
WARNING: Failed to start process
java.io.IOException: error=2, No such file or directory
	at com.zaxxer.nuprocess.internal.LibJava8.Java_java_lang_UNIXProcess_forkAndExec(Native Method)
	at com.zaxxer.nuprocess.linux.LinuxProcess.start(LinuxProcess.java:109)
	at com.zaxxer.nuprocess.linux.LinProcessFactory.createProcess(LinProcessFactory.java:40)
	at com.zaxxer.nuprocess.NuProcessBuilder.start(NuProcessBuilder.java:266)
	at bloop.launcher.core.Shell.runCommand(Shell.scala:87)
	at bloop.launcher.core.Shell.detectBloopInSystemPath(Shell.scala:153)
	at bloop.launcher.LauncherMain.detectServerState(Launcher.scala:232)
	at bloop.launcher.LauncherMain.connectToBloopBspServer(Launcher.scala:159)
	at bloop.launcher.LauncherMain.runLauncher(Launcher.scala:95)
	at bloop.launcher.LauncherMain.cli(Launcher.scala:78)
	at bloop.launcher.LauncherMain.main(Launcher.scala:59)
	at bloop.launcher.Launcher.main(Launcher.scala)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at coursier.bootstrap.Bootstrap.main(Unknown Source)

A bloop installation has been detected either in the PATH or $HOME/.bloop

NuProcess library is using a logger, which always logs warning when it cannot start, but since bloop is reading the result of the command from the exit code, I am wondering how this (small, but annoying) issue could be addressed? Please, suggest/discuss better solution if you have one.

This PR is a simplest fix I could come up with: disabling warnings from NuProcess (the impact analysis is at the end of this message). It gives us more clear output:

Starting the bsp launcher for bloop...
A bloop installation has been detected either in the PATH or $HOME/.bloop

Analysis:
NuProcess is inconsistent... most of the time it just swallows the exception, but in three cases it also logs warnings, before doing nothing...

Those warnings are logged when exception happens while:
a) reading stdout/stderr
b) starting process
c) creating pipes - but this cases does not affect launcher, since the exception is actually propagated after being logged

I believe both a) and b) are of low impact, since launcher depends on exit codes anyway

@jvican jvican changed the title disable warnings logged by nuprocess library Disable warnings logged by nuprocess library Jan 16, 2019
Copy link
Contributor

@jvican jvican left a comment

Choose a reason for hiding this comment

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

LGTM, that's a good analysis. I'm merging, a release will be done automatically by the CI and the launcher reference page will contain its latest release version.

@jvican jvican merged commit 207a149 into scalacenter:master Jan 16, 2019
@jvican jvican added enhancement ergonomics Any change that affects developer ergonomics and the easiness of use of bloop. launcher labels Jan 16, 2019
@mzarnowski mzarnowski deleted the disable-nuprocess-warnings branch January 16, 2019 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ergonomics Any change that affects developer ergonomics and the easiness of use of bloop. launcher
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants