Repository navigation
Conversation
musl flushes stdout/stderr via writev, so wrap it and route STDOUT_FILENO/STDERR_FILENO writes through SbLogRaw, which lands in Android logcat. Bug: 495203133
🤖 Gemini Suggested Commit Message💡 Pro Tips for a Better Commit Message:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0c7405cf35
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Route stdout/stderr writes, which musl flushes via writev, through SbLogRaw | ||
| // so they reach Android logcat. | ||
| ssize_t __wrap_writev(int fd, const struct iovec* iov, int iovcnt) { | ||
| if (fd == STDOUT_FILENO || fd == STDERR_FILENO) { |
There was a problem hiding this comment.
Preserve writes after stdout/stderr redirection
This check treats file descriptor numbers 1 and 2 as logcat forever, even after code redirects them with dup2/freopen. GoogleTest's capture support does exactly that by dup2(captured_fd, fd_) before reading the temp file back (third_party/googletest/src/googletest/src/gtest-port.cc:1150-1166), so any captured printf/fprintf flush that musl emits via writev will be reported as successfully written but sent to SbLogRaw instead of the capture file. That makes captured stdout/stderr and death-test stderr logs come back empty on the Android Starboard build this wrapper targets.
Useful? React with 👍 / 👎.
musl flushes stdout/stderr via writev, so wrap it and route STDOUT_FILENO/STDERR_FILENO writes through SbLogRaw, which lands in Android logcat.
Bug: 495203133