chenBright commented on code in PR #3599:
URL: https://github.com/apache/brpc/pull/3599#discussion_r4267095870


##########
test/run_tests.sh:
##########
@@ -24,13 +24,17 @@ failed_test=""
 rc=0
 test_bins="test_butil test_bvar bthread*unittest brpc*unittest"
 export ASAN_OPTIONS="detect_leaks=1:detect_stack_use_after_return=1"
+# Keep the original stdin on fd 3 for asynchronous test processes.
 for test_bin in $test_bins; do
     test_num=$((test_num + 1))
     >&2 echo "[runtest] $test_bin"
     # A passing death test may leave a core behind. Keep only cores from the
     # binary about to run so a later failure is symbolized against its core.
     rm -f core.*
-    ./$test_bin
+    # Preserve stdin while starting the test asynchronously to capture its PID.
+    ./"$test_bin" <&3 3<&- &

Review Comment:
   Declined as duplicate style suggestions. Loop-scoped redirection 
automatically restores FD 3 after completion or break, without manual cleanup.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to