Commit 6017e812 authored by Tigran Mkrtchyan's avatar Tigran Mkrtchyan
Browse files

nfsv4-client: single point to exit command loop

Motivation:
user interrupt and commend quit/exit should have the same exit path.

Result:
single point to exit command loop

Acked-by: Lea Morschel
Target: master
parent ad9c203b
......@@ -147,7 +147,7 @@ public class Main {
try (PrintWriter out = new PrintWriter(terminal.output())) {
while ((line = reader.readLine(PROMPT)) != null) {
cloop: while ((line = reader.readLine(PROMPT)) != null) {
line = line.trim();
if (line.length() == 0) {
continue;
......@@ -375,11 +375,7 @@ public class Main {
}
case "quit":
case "exit": {
if (nfsClient != null) {
nfsClient.destroy_session();
nfsClient.destroy_clientid();
}
System.exit(0);
break cloop;
}
default: {
out.println("Supported commands: ");
......@@ -398,7 +394,9 @@ public class Main {
} catch (UserInterruptException | EndOfFileException e) {
terminal.flush();
terminal.close();
nfsClient.umount();
if (nfsClient != null) {
nfsClient.umount();
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment