Hi!
Really nice work with this BOF and thanks for the great blogpost.
I discovered a corner case which breaks the output redirection if you run it from within a go program, e.g. this one.
I do not understand the reason and frankly the code is above my C level of understanding but with some debugging I identified that it can be fixed by removing the check in this line (and the subsequent one for stderr).
Hope this helps some people who struggle with the same issue and happy about input how to fix it properly.