prepare for stdin/stdout