Skip to content

Commit 5bf0e31

Browse files
asprof collect fails when the target process concurrently terminates (async-profiler#1614)
1 parent 8772214 commit 5bf0e31

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,12 +588,13 @@ int main(int argc, const char** argv) {
588588
signal(SIGTERM, sigint_handler);
589589

590590
while (time_micros() < end_time) {
591+
sleep(1);
592+
591593
if (kill(pid, 0) != 0) {
592594
fprintf(stderr, "Process exited\n");
593595
if (use_tmp_file) print_file(file, STDOUT_FILENO);
594596
return 0;
595597
}
596-
sleep(1);
597598
}
598599

599600
fprintf(stderr, end_time != 0 ? "Done\n" : "Interrupted\n");

0 commit comments

Comments
 (0)