From 434d31ddb413a3738d43c4a4b59a9ccdd01b719f Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Wed, 7 Mar 2012 02:37:06 +0400 Subject: [PATCH] better code for prompt --- framework/console/Command.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/framework/console/Command.php b/framework/console/Command.php index 16ba810..eef9035 100644 --- a/framework/console/Command.php +++ b/framework/console/Command.php @@ -325,15 +325,13 @@ abstract class Command extends \yii\base\Component } else { echo $message; $input = fgets(STDIN); - if($input !== false) { - $input = trim($input); - } } if($input === false) { return false; } else { - return empty($input) ? $default : $input; + $input = trim($input); + return $input==='' ? $default : $input; } }