1
0
Fork 0
mirror of https://github.com/albfan/miraclecast.git synced 2025-02-12 14:11:56 +00:00

miracle-sinkctl: don't use readline if no stdin

Signed-off-by: Eric Nelson <eric@nelint.com>
This commit is contained in:
Eric Nelson 2017-04-07 18:26:19 -07:00 committed by albfan
parent c3f6b7f683
commit fe9a39bee8

View file

@ -317,28 +317,27 @@ int cli_init(sd_bus *bus, const struct cli_cmd *cmds)
}
}
if (isatty(fileno(stdin))) {
r = sd_event_add_io(cli_event,
&cli_stdin,
fileno(stdin),
EPOLLHUP | EPOLLERR | EPOLLIN,
cli_stdin_fn,
NULL);
if (r < 0) {
cli_vERR(r);
goto error;
}
}
if (isatty(fileno(stdin))) {
r = sd_event_add_io(cli_event,
&cli_stdin,
fileno(stdin),
EPOLLHUP | EPOLLERR | EPOLLIN,
cli_stdin_fn,
NULL);
if (r < 0) {
cli_vERR(r);
goto error;
}
cli_rl = true;
cli_rl = true;
rl_erase_empty_line = 1;
rl_callback_handler_install(NULL, cli_handler_fn);
rl_erase_empty_line = 1;
rl_callback_handler_install(NULL, cli_handler_fn);
rl_set_prompt(CLI_PROMPT);
printf("\r");
rl_on_new_line();
rl_redisplay();
rl_set_prompt(CLI_PROMPT);
printf("\r");
rl_on_new_line();
rl_redisplay();
}
return 0;