mirror of
https://github.com/albfan/miraclecast.git
synced 2025-02-12 21:51:56 +00:00
Avoid config stdin if not a tty
Allow to run miracle-sinkctl as a service relates to #98
This commit is contained in:
parent
04a1ec8aa3
commit
b8de12cab3
1 changed files with 12 additions and 10 deletions
|
@ -317,16 +317,18 @@ int cli_init(sd_bus *bus, const struct cli_cmd *cmds)
|
|||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue