cli: Flush stdout before fork()ing to run hooks