NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Integration using stdin doesn't work


Joined: 22 Nov 2013
Posts: 4
Reply with quote
I do everything exactly as described here: http://forum.nusphere.com/howto-use-a-php-script-for-my-editing-t753.html
But when I run the command, php-cgi is executed and I see empty black console, waiting for user input from stdin. When I type something there and press enter, then it shows typed string in double quotes and then exits. Looks like phped doesn't write anything to executed script's STDIN. How can I fix it?
View user's profileFind all posts by windbridgesSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7823
Reply with quote
STDIN is an input stream, it's not expected to produce any output from the IDE.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 22 Nov 2013
Posts: 4
Reply with quote
hmm, I thought I can read editor's selected text from stdin if I set "Work with editor" -> "Take input from..." -> "Selected text", isn't it?
I want to read selected text, transorm it and send back to editor. How I can do that?
View user's profileFind all posts by windbridgesSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7823
Reply with quote
yes you can read that, but it's not expected to appear in console until you echo it

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 22 Nov 2013
Posts: 4
Reply with quote
Maybe I didn't described the problem clear enough.
I run this example:
Code:
<?php

$f = fopen("php://stdin", "r");
$s = fread($f, 100000); // should be big enough
fclose($f);
echo "\"" . $s . "\"";

?>


When I run it from menu, I see empty console, waiting for user input on line
Code:
$f = fopen("php://stdin", "r");
instead of reading editor contents from stdin.
It will wait infinitely, until I type something there and hit Enter.
And then script prints typed text in doublequotes (NOT editor's content!), according to line
Code:
echo "\"" . $s . "\"";
View user's profileFind all posts by windbridgesSend private message
Veteran

Joined: 02 Sep 2007
Posts: 116
Location: Kiel, Germany
Reply with quote
Which version of PhpED do you use? I noticed this problem in Version 10.0.10035, and it was fixed one or two builds later, IIRC. At the moment I use 10.0.10045, and it works, although I often see the console window for a moment, which had never been the case before 10.0.10035. I didn't try version 11 yet.

Cheers,
Jan
View user's profileFind all posts by EnigmaSend private message


Joined: 22 Nov 2013
Posts: 4
Reply with quote
Thank you, problem was solved with installing 10.0.10045
View user's profileFind all posts by windbridgesSend private message
Integration using stdin doesn't work
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic