rz-find: flush output to avoid undeterminism (#6527)

Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
This commit is contained in:
NOT XVilka 2026-06-18 14:56:02 +08:00 committed by GitHub
parent 110c812219
commit 070c004e0c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View file

@ -160,6 +160,8 @@ static int hit(RzSearchKeyword *kw, void *user, ut64 addr) {
}
if (ro->exec_command) {
char *command = rz_str_newf("%s %s", ro->exec_command, ro->curfile);
// Flush buffered output before spawning the command
fflush(stdout);
int status = rz_sys_system(command);
if (status == -1) {
RZ_LOG_ERROR("Failed to execute command: %s\n", command);

View file

@ -159,12 +159,12 @@ NAME=rz-find -E
TOOL=rz-find
ARGS=-E echo -s Password bins/elf/ioli/crackme0x00
EXPECT=<<EOF
bins/elf/ioli/crackme0x00
bins/elf/ioli/crackme0x00
bins/elf/ioli/crackme0x00
0x581
bins/elf/ioli/crackme0x00
0x59e
bins/elf/ioli/crackme0x00
0x5a9
bins/elf/ioli/crackme0x00
EOF
RUN