Merge pull request #6019 from eatkins/client-properties

Parse network client arguments early
This commit is contained in:
eugene yokota 2020-10-24 17:30:18 -04:00 committed by GitHub
commit 1692b93ec3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 3 deletions

View File

@ -1072,7 +1072,7 @@ object NetworkClient {
} }
def client( def client(
baseDirectory: File, baseDirectory: File,
args: Array[String], args: Arguments,
inputStream: InputStream, inputStream: InputStream,
errorStream: PrintStream, errorStream: PrintStream,
terminal: Terminal, terminal: Terminal,
@ -1080,7 +1080,7 @@ object NetworkClient {
): Int = { ): Int = {
val client = val client =
simpleClient( simpleClient(
NetworkClient.parseArgs(args).withBaseDirectory(baseDirectory), args.withBaseDirectory(baseDirectory),
inputStream, inputStream,
errorStream, errorStream,
useJNI, useJNI,
@ -1091,6 +1091,15 @@ object NetworkClient {
else 1 else 1
} catch { case _: Exception => 1 } finally client.close() } catch { case _: Exception => 1 } finally client.close()
} }
def client(
baseDirectory: File,
args: Array[String],
inputStream: InputStream,
errorStream: PrintStream,
terminal: Terminal,
useJNI: Boolean
): Int = client(baseDirectory, parseArgs(args), inputStream, errorStream, terminal, useJNI)
private def simpleClient( private def simpleClient(
arguments: Arguments, arguments: Arguments,
inputStream: InputStream, inputStream: InputStream,
@ -1129,9 +1138,10 @@ object NetworkClient {
}) })
Runtime.getRuntime.addShutdownHook(hook) Runtime.getRuntime.addShutdownHook(hook)
if (Util.isNonCygwinWindows) sbt.internal.util.JLine3.forceWindowsJansi() if (Util.isNonCygwinWindows) sbt.internal.util.JLine3.forceWindowsJansi()
val parsed = parseArgs(restOfArgs)
System.exit(Terminal.withStreams(false) { System.exit(Terminal.withStreams(false) {
val term = Terminal.console val term = Terminal.console
try client(base, restOfArgs, term.inputStream, System.err, term, useJNI) try client(base, parsed, term.inputStream, System.err, term, useJNI)
catch { case _: AccessDeniedException => 1 } finally { catch { case _: AccessDeniedException => 1 } finally {
Runtime.getRuntime.removeShutdownHook(hook) Runtime.getRuntime.removeShutdownHook(hook)
hook.run() hook.run()