Reset terminal mode before and set terminal mode after running external command.