open fd
set minimal flags
cleanup and flush stdout