Hi Dave, 2015-02-25 1:13 GMT+01:00 David T. Lewis <le...@mail.msen.com>:
> On Tue, Feb 24, 2015 at 08:33:41PM +0100, jannik laval wrote: > > Hi pharoers, > > > > I am playing with OSProcess. > > I am using an example, and I am annoyed with a strange bug: > > > > Here is the code I want to execute, and does not work: > > ==== > > |thread process output| > > myCmd := 'rostopic bw /turtle1/pose'. > > thread := [process := (PipeableOSProcess command: myCmd) ] fork. > > 3 second wait. > > output := process upToEnd. > > output inspect. > > thread terminate. > > === > > Hi Jannik, > > I am not familiar with the rostopic command, but it is common for some > Unix programs to flush their output when the stdout is connected to > /dev/tty (a terminal), but not necessarily if connected to a pipe or > to a file. So it may be that the running rostopic program is producing > output, but that the output has not yet been flushed to the pipe connected > to your PipeableOSProcess. > Thank you for your explanation. So, what I can do is to send a sigint to terminate the process and receive the info. But sending "process processProxy sigint." does nothing. By the way I have a warning on the AIOPlugin... Probably I should reinstall my VM. I also try "process flush", but it does not do anything. > > Your #upToEnd call will read the available data from the OS pipe, but it > will not read data that was "written" by the rotopic program, but not > yet flushed out to the OSPipe. So I am guessing that this may be why the > data seems to be missing. > > I notice also that you are putting your PipeableOSProcess into a separate > Smalltalk process using #fork. This is probably not necessary, so try > getting rid of the #fork and the later thread terminate. It will not fix > the problem for you, but it will simplify the code. > Ok, it is simpler like that. You are right, it does not help :) Thank you for your help. > > Dave > > > > > > 'rostopic bw /turtle1/pose' is a command that is a loop displaying the > > current bandwidth of a ROS process. In a terminal, it works fine. With > > OSProcess the output value is empty. > > > > My source code is correct: if I replace myCmd by : > > myCmd := 'ping localhost'. > > > > It is a loop too, and it returns a correct string. > > > > I have clearly no idea of where I have to search... Any help or > discussion > > about that would be great :) > > > > Thank you, > > > > Oups, some infos: > > I am using Ubuntu 14.04 > > Pharo3.0 with Moose 5.0, latest update: #30863 > > The script I use (rostopic) is a python script (does it impact ?) > > > > > > -- > > > > ~~Jannik Laval~~ > > ??cole des Mines de Douai > > Enseignant-chercheur > > http://www.jannik-laval.eu > > http://www.phratch.com > > http://www.approchealpes.info > > http://car.mines-douai.fr/ > > -- ~~Jannik Laval~~ École des Mines de Douai Enseignant-chercheur http://www.jannik-laval.eu http://www.phratch.com http://www.approchealpes.info http://car.mines-douai.fr/