fix: keep FIFO fd open across both writes to prevent hang
Co-authored-by: aider (deepseek/deepseek-reasoner) <aider@aider.chat>
This commit is contained in:
@@ -860,8 +860,7 @@ static int test_fifo_pipe(void) {
|
||||
return 1;
|
||||
}
|
||||
write(fd, "add\n", 4);
|
||||
close(fd);
|
||||
|
||||
/* Keep fd open; do NOT close yet */
|
||||
safe_usleep(1500000); /* give main loop time to process */
|
||||
|
||||
const char **ports = jack_get_ports(client, NULL, JACK_DEFAULT_AUDIO_TYPE, 0);
|
||||
@@ -876,14 +875,7 @@ static int test_fifo_pipe(void) {
|
||||
jack_free(ports);
|
||||
}
|
||||
|
||||
/* Write "remove\n" to the FIFO */
|
||||
fd = open("/tmp/looper_cmd", O_WRONLY);
|
||||
if (fd < 0) {
|
||||
perror("open fifo");
|
||||
jack_client_close(client);
|
||||
kill(pid, SIGTERM); waitpid(pid, NULL, 0);
|
||||
return 1;
|
||||
}
|
||||
/* Write "remove\n" to the FIFO, same fd */
|
||||
write(fd, "remove\n", 7);
|
||||
close(fd);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user