提交 f3da0e49 编写于 作者: J Jesse Glick

Minor review comments from @oleg-nenashev.

上级 2e7fe04d
......@@ -53,23 +53,28 @@ class PlainCLIProtocol {
/** One-byte operation to send to the other side. */
private enum Op {
/** UTF-8 command name or argument. */
ARG,
ARG(true),
/** UTF-8 locale identifier. */
LOCALE,
LOCALE(true),
/** UTF-8 client encoding. */
ENCODING,
ENCODING(true),
/** Start running command. */
START,
START(true),
/** Exit code, as int. */
EXIT,
EXIT(false),
/** Chunk of stdin, as int length followed by bytes. */
STDIN,
STDIN(true),
/** EOF on stdin. */
END_STDIN,
END_STDIN(true),
/** Chunk of stdout. */
STDOUT,
STDOUT(false),
/** Chunk of stderr. */
STDERR
STDERR(false);
/** True if sent from the client to the server; false if sent from the server to the client. */
final boolean clientSide;
Op(boolean clientSide) {
this.clientSide = clientSide;
}
}
static abstract class EitherSide implements Closeable {
......@@ -150,6 +155,9 @@ class PlainCLIProtocol {
// in case trick in CLIAction does not work
LOGGER.log(Level.FINE, null, x);
handleClose();
} catch (RuntimeException x) {
LOGGER.log(Level.WARNING, null, x);
handleClose();
}
}
......@@ -233,6 +241,7 @@ class PlainCLIProtocol {
@Override
protected final boolean handle(Op op, int framelen) throws IOException {
assert Thread.currentThread() instanceof EitherSide.Reader;
assert op.clientSide;
switch (op) {
case ARG:
onArg(dis.readUTF());
......@@ -292,6 +301,7 @@ class PlainCLIProtocol {
@Override
protected boolean handle(Op op, int framelen) throws IOException {
assert Thread.currentThread() instanceof EitherSide.Reader;
assert !op.clientSide;
switch (op) {
case EXIT:
onExit(dis.readInt());
......
......@@ -22,4 +22,5 @@
blurb=\
Allowing Jenkins CLI to work in <code>-remoting</code> mode is considered dangerous and usually unnecessary. \
You are advised to disable this mode.
You are advised to disable this mode. \
Please refer to the <a href="https://jenkins.io/doc/book/managing/cli/">CLI documentation</a> for details.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册