So you mean 'rostopic echo' and 'rostopic pub' ?   So its a
publisher/subscriber model with 'echo' as the subscriber ?

(I'll needs others to confirm this is possible but...) the way to go may be
to fork 'rotopic echo' and leave it running, parsing its results into a
queue that some other part of your program consumes.

To simplify this to check feasibility, I'd start with a single shell script
outputting text at intervals like this...
    "test.sh"
    for VARIABLE in 1 2 3 4 5 .. N
    do
echo $VARIABLE
sleep 2
    done


and in Pharo, assuming you can process the output stream asynchronously,
every time you receive a newline, open an inspector showing the line just
received.  But sorry I don't know *PipeableOSProcess enough to know how.*

*cheers -ben*


On Tue, Jan 13, 2015 at 11:05 PM, Demian Schkolnik <
demianschkol...@gmail.com> wrote:

> It is actually not a native linux command, but rather something belonging
> to ROS (Robot Robot Operating System). I did not want to complicate the
> question further.. The behaviour is as I described it. This echo command
> sits still in the console where it was called, and waits. When some message
> is send, then it just prints the message on screen and waits. The pub
> method (also belonging to ROS) publishes a message and exits.
> I tried Ben's solution (thanks!), but unfortunately stringVar remains nil.
> I think the problem is we are assigning the output of the command to
> stringVar, which is nothing, at the moment.
> Any ideas?
> Thank you all.
>
> El Tue Jan 13 2015 at 6:15:01, Ben Coman <b...@openinworld.com> escribió:
>
> I've never known 'echo' to wait for input, and haven't heard of this echo
>> & pub combination.  Do you have some link to a tutorial showing how they
>> are used?
>>
>> However just wildly guessing, are you wanting to get output from a long
>> running command without blocking the Pharo UI?
>> In that case, what about...
>>     [ *stringVar := (PipeableOSProcess  command: 'echo...') output ]
>> fork. *
>> *?*
>> *cheers -ben*
>>
>> On Tue, Jan 13, 2015 at 9:18 AM, Demian Schkolnik <
>> demianschkol...@gmail.com> wrote:
>>
>>> Hello everyone.
>>>
>>> I have the following question. I have a specific 'echo ...' command,
>>> which I send to the linux console via " OSProcess command:'echo ... ' ".
>>> This echo command, when executed on the native linux console, stands by
>>> until it receives some message.
>>> Following this, I have to execute a 'pub...' command, which gives some
>>> information that the echo command will print on screen. On linux, you run
>>> 'echo..' on a terminal and 'pub...' on another.
>>> My objective here is to capture the output of echo into a smalltalk
>>> variable for later use.
>>> Normally, if a console command prints something immediately to screen, I
>>> use
>>> *(PipeableOSProcess command:'some command') output.*
>>>
>>> It is here a little different though, since this command will not print
>>> something immediately to screen. I want to do something like this, where
>>> the final output of 'echo..' stays in stringVar.
>>>
>>> *stringVar := (PipeableOSProcess  command: 'echo...') output. *
>>> *(Delay forSeconds:3) wait.*
>>> *(OSProcess command: 'pub... ').*
>>> *(Delay forSeconds:3) wait.*
>>>
>>> Thank you all.
>>>
>>>
>>>
>>>
>>

Reply via email to