Hi David,<br><br><div class="gmail_quote">On Sat, Nov 20, 2010 at 9:07 AM, David T. Lewis <span dir="ltr">&lt;<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
On Fri, Nov 19, 2010 at 03:56:26PM -0200, Casimiro de Almeida Barreto wrote:<br>
&gt; Em 19-11-2010 15:39, Mike Hales escreveu:<br>
&gt; &gt; Thanks, that&#39;s just want I wanted. And thanks Sean for the tip on<br>
&gt; &gt; the <a href="http://forum.world.st/" target="_blank">http://forum.world.st/</a> index. That&#39;s pretty handy having all the<br>
&gt; &gt; lists together in one spot.<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; Mike<br>
&gt; &gt;<br>
&gt; &gt; Mike Hales<br>
&gt; &gt; Engineering Manager<br>
&gt; &gt; KnowledgeScape<br>
&gt; &gt; <a href="http://www.kscape.com" target="_blank">www.kscape.com</a> &lt;<a href="http://www.kscape.com" target="_blank">http://www.kscape.com</a>&gt;<br>
&gt; BTW, if you&#39;re running squeak over CogVM it wont work... there are<br>
&gt; incompatibilities between OSProcess, CommandShell and OSProcessPlugin<br>
&gt; and cog.<br>
&gt;<br>
&gt; Interesting enough, if I do:<br>
&gt;<br>
&gt; | str |<br>
&gt;<br>
&gt;     str := (PipeableOSProcess command: &#39;ls -l&#39;) upToEnd.<br>
&gt;<br>
&gt; It will return and empty ByteString but will fail to read output from<br>
&gt; stdOut.<br>
<br>
This is just a timing glitch. Try this instead and I think you will<br>
get the results you want. This works on both Cog and the interpreter VM:<br>
<br>
  (PipeableOSProcess command: &#39;ls -l&#39;) upToEndOfFile<br>
<br>
Piping to and from an external process can be a bit tricky. A program<br>
like /bin/ls will exit only after you close the pipe to its standard<br>
input (the #command: method does this for you). After that pipe closes,<br>
the /bin/ls program will flush its standard output stream to the<br>
pipe that is connected back to Squeak. Some time after that, the<br>
data will become available for Squeak to read. When you do #upToEnd,<br>
you are reading all available data on that pipe, and if you happen<br>
to read it before it is all available, you get an empty string.<br>
The #upToEndOfFile keeps trying to read until the pipe is actually<br>
closed (when /bin/ls exits), so this makes sure you get all of the<br>
output data even when you are running on a really fast Cog VM :)<br>
<br>
&gt;<br>
&gt; Forking PipeableOSProcess won&#39;t work when using cog.<br>
&gt;<br>
&gt; like:<br>
&gt;<br>
&gt; ps := PipeableOSProcess forkHeadlessSqueakAndDoThenQuit: [ ... ]<br>
&gt;<br>
&gt; will fail crashing cog (memory fault). At least under linux.<br>
<br>
As far as I know, then only part of OSProcess/CommandShell that<br>
does not work in Cog is the #forkSqueak methods. Unfortunately,<br>
#forkSqueak is used extensively in the unit tests, so be careful<br>
about running those under Cog. But all other OSProcess and CommandShell<br>
functions seem to work fine in Cog.<br></blockquote><div><br></div><div>Any idea what it is about forkSqueak that breaks Cog?</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<br>
You may get a warning dialog about AioPlugin not present. This is<br>
because the plugin was not included in the Cog VM, and you can<br>
safely ignore the warning.<br>
<br>
Dave<br></blockquote><div><br></div><div>best</div><div>Eliot </div></div>