Go to Run -> Edit Configurations -> Additional options -> Check "Emulate terminal in the output console"