diff options
author | pseudoc <atlas.yu@canonical.com> | 2023-08-29 15:19:36 +0800 |
---|---|---|
committer | Atlas Yu <atlas.yu@canonical.com> | 2024-03-08 01:56:42 +0000 |
commit | ac0531bbf81c4a58918c7b7837ba87c76edef639 (patch) | |
tree | bd680759e4b0ab2c0394d7714e7b4f0da1bb4c30 | |
parent | f818ae17ae0e51f00eca71b0fc8e12dadd8b0299 (diff) |
This will also make commands like following work, and gracefully
exit after play the recording once.
`echo | evemu-play recording`
-rw-r--r-- | tools/evemu-play.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/evemu-play.c b/tools/evemu-play.c index 776843d..4140567 100644 --- a/tools/evemu-play.c +++ b/tools/evemu-play.c @@ -198,7 +198,10 @@ static int play_from_file(int recording_fd) printf("Hit enter to start replaying"); fflush(stdout); - fgets(line, sizeof(line), stdin); + + // fgets() returns NULL on EOF + if (!fgets(line, sizeof(line), stdin)) + break; fseek(fp, 0, SEEK_SET); ret = evemu_play(fp, fd); |