Support mac, duplicate stdin/stdout to make piping possible.