blobcli: exit shell when EOF is encountered

Change-Id: I660c2b37b22b4a60b6ebcd77ade475072a6a05a7
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/398079
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Daniel Verkamp 2018-02-01 10:15:29 -07:00 committed by Jim Harris
parent 7fc141712f
commit 168bc9f11a

View File

@ -1296,6 +1296,13 @@ cli_shell(void *arg1, void *arg2)
printf("blob> ");
bytes_in = getline(&line, &buf_size, stdin);
/* If getline() failed (EOF), exit the shell. */
if (bytes_in < 0) {
free(line);
cli_context->action = CLI_SHELL_EXIT;
return true;
}
/* parse input and update cli_context so we can use common option parser */
if (bytes_in > 0) {
tok = strtok(line, " ");