Run on external console / Write to STDIN?
Hi,
I`m debugging my cli scripts with php-storm, but I have problem a when it comes to STDIN.
My scripts have some questions/answers at runtime, which the script reads from the STDIN and branches the execution.
readlineScript:
public static function readLine()
{
$text = "";
do
{
$char = fread(STDIN, 1);
$text .= $char;
} while($char != "\n");
return trim($text);
}
Is it possible to write to the STDIN with phpstorm, or is it somehow possible to debug cli scripts on an external console?
Please sign in to leave a comment.
See http://stackoverflow.com/questions/5315247/debug-php-command-line-script-in-phpstorm for sample remote configuration.
As http://youtrack.jetbrains.net/issue/WI-5132 is addressed in 3.0, it should be easier in the next version.
Basic input should work in the console, but it's not a real terminal, so the functionality may be limited.
I think the problems associated with these links are different than my question.
I have no problem debuging CLI scripts, yet it does work perfectly including startup parameters.
The Console-Tab does show the script output, but unfortunately I can`t write anything into the console. Or is there a workaround for typing characters into the console?
As you can see in my attached screenshot, I need to send a simple "y" or "n" to my script in order to continue execution.
Attachment(s):
screenshot1.png
The link I sent you shows how to run a script in real terminal/console and have debugging. This should solve the problem if the input doesn't work in the built-in console.
Hello droth,
Please vote - http://youtrack.jetbrains.net/issue/WI-6093
Thank you for feedback!