summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpseudoc <atlas.yu@canonical.com>2023-08-29 15:19:36 +0800
committerAtlas Yu <atlas.yu@canonical.com>2024-03-08 01:56:42 +0000
commitac0531bbf81c4a58918c7b7837ba87c76edef639 (patch)
treebd680759e4b0ab2c0394d7714e7b4f0da1bb4c30
parentf818ae17ae0e51f00eca71b0fc8e12dadd8b0299 (diff)
fix(evemu-play): exit on EOFHEADmaster
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.c5
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);