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

Suggest users to clean working directory when Nailgun server failed #1916

Merged
merged 2 commits into from
Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ trait BloopRifleLogger { self =>
def debug(msg: => String, ex: Throwable): Unit
final def debug(msg: => String): Unit = debug(msg, null)
def error(msg: => String, ex: Throwable): Unit
def error(msg: => String): Unit
def runnable(name: String)(r: Runnable): Runnable = { () =>
try r.run()
catch {
Expand Down Expand Up @@ -39,6 +40,7 @@ object BloopRifleLogger {
def info(msg: => String) = {}
def debug(msg: => String, ex: Throwable) = {}
def error(msg: => String, ex: Throwable) = {}
def error(msg: => String) = {}
def bloopBspStdout = None
def bloopBspStderr = None
def bloopCliInheritStdout = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ object Operations {
}
val runnable: Runnable = logger.runnable(threadName) { () =>
val maybeRetCode = Try {
nailgunClient0.run(
val retCode = nailgunClient0.run(
"bsp",
protocolArgs,
workingDir,
Expand All @@ -349,6 +349,12 @@ object Operations {
stop0,
interactiveSession = false
)
if (retCode != 0)
logger.error(
s"""Bloop 'bsp' command exited with code $retCode. Something may be wrong with the current configuration.
|Running the ${Console.BOLD}clean${Console.RESET} sub-command to clear the working directory and remove caches might help.
|If the error persists, please report the issue as a bug and attach a log with increased verbosity by passing ${Console.BOLD}-v -v -v${Console.RESET}.""".stripMargin)
retCode
}
try promise.complete(maybeRetCode)
catch { case _: IllegalStateException => }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ case class TestLogger(info: Boolean = true, debug: Boolean = false) extends Logg
System.err.println(msg)
if (ex != null) ex.printStackTrace(System.err)
}
def error(msg: => String): Unit = System.err.println(msg)
def info(msg: => String): Unit =
System.err.println(msg)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,11 @@ class CliLogger(
ex.printStackTrace(out)
}
def error(msg: => String, ex: Throwable) = {
logger.log(s"Error: $msg ($ex)")
logger.error(s"Error: $msg ($ex)")
if (verbosity >= 1 && ex != null)
ex.printStackTrace(out)
}
def error(msg: => String) = logger.error(msg)
def bloopBspStdout =
if (verbosity >= 2) Some(out)
else None
Expand Down