rust-mobile / android-activity

Glue for building Rust applications on Android with NativeActivity or GameActivity
238 stars 46 forks source link

Close `logpipe` input file descriptor after `dup2()` #116

Closed MarijnS95 closed 11 months ago

MarijnS95 commented 1 year ago

When the input file descriptor of the pipe() is dup2()'d into stdin and stdout it is effectively copied, leaving the original file descriptor open and leaking at the end of these statements. Only the output file descriptor has its ownership transferred to File and will be cleaned up properly.

This should cause the reading end to read EOF and return zero bytes when stdin and stdout is open, rather than remaining open "indefinitely" (barring the whole process being taken down) as there will always be that one file descriptor referencing the input end of the pipe.