Use process.stdout.write instead of readline write

readline write does not appear in re-directed output