OSProcess?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

OSProcess?

Alexandre Bergel-2
Hello,

I would like to launch the unix/cygwin make command within Squeak
It seems that OSProcess would help in doing it. But I run into troubles.

when I doit: OSProcess command: 'ls -l /etc'
I got a rollback. The following "self initialStdErr nextPutAll:  
'cannot execute ', self commandLine" tried to be executed.

I installed OSProcess, OSProcess plugins and CommandLauncher.

Is there anything supposed to be obvious that I missed ?
The file Win32OSProcessPlugin.dll is in the same directory than the  
VM and the image.

Note: I am using Windows XP, cygwin and Squeak 7035.

Help would be highly appreciated...
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.cs.tcd.ie/Alexandre.Bergel
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




Reply | Threaded
Open this post in threaded view
|

Re: OSProcess?

David T. Lewis
On Fri, Jul 21, 2006 at 03:30:26PM +0100, Alexandre Bergel wrote:

> Hello,
>
> I would like to launch the unix/cygwin make command within Squeak
> It seems that OSProcess would help in doing it. But I run into troubles.
>
> when I doit: OSProcess command: 'ls -l /etc'
> I got a rollback. The following "self initialStdErr nextPutAll:  
> 'cannot execute ', self commandLine" tried to be executed.
>
> I installed OSProcess, OSProcess plugins and CommandLauncher.
>
> Is there anything supposed to be obvious that I missed ?
> The file Win32OSProcessPlugin.dll is in the same directory than the  
> VM and the image.
>
> Note: I am using Windows XP, cygwin and Squeak 7035.

Alexandre,

Sorry, you can do this on unix based platforms, but not on windows.
The Win32 version of OSPP is quite limited, and does not support
the necessary command piping.

Dave


Reply | Threaded
Open this post in threaded view
|

Re: OSProcess?

Alexandre Bergel-2
> Sorry, you can do this on unix based platforms, but not on windows.
> The Win32 version of OSPP is quite limited, and does not support
> the necessary command piping.

Arg...
So, I will hack something. I will probably do a small program in Peal  
or Ruby that open a socket and wait for commands to be sent through  
this socket. Any better idea welcomed...

Cheers,
Alexandre

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.cs.tcd.ie/Alexandre.Bergel
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




Reply | Threaded
Open this post in threaded view
|

Re: OSProcess?

dcorking
On 7/23/06, Alexandre Bergel <[hidden email]> wrote:
> > Sorry, you can do this on unix based platforms, but not on windows.
> > The Win32 version of OSPP is quite limited, and does not support
> > the necessary command piping.

I am puzzled.  Why is piping necessary to run 'ls -l /etc ;' ?

> Arg...
> So, I will hack something. I will probably do a small program in Peal
> or Ruby that open a socket and wait for commands to be sent through
> this socket. Any better idea welcomed...

I don't have any better ideas - but how about a worse one - how about
compiling the unix OSProcess plugin (and unix vm) under cygwin?
Perhaps it has never been done, but it may be fun to try.  Cygwin
supports most of the unix/posix API.

Reply | Threaded
Open this post in threaded view
|

Re: OSProcess?

Alexandre Bergel-2
> I don't have any better ideas - but how about a worse one - how about
> compiling the unix OSProcess plugin (and unix vm) under cygwin?
> Perhaps it has never been done, but it may be fun to try.  Cygwin
> supports most of the unix/posix API.

Humm.... May work. I will give a try soon...

Thanks!

Cheers,
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.cs.tcd.ie/Alexandre.Bergel
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




Reply | Threaded
Open this post in threaded view
|

Re: OSProcess?

David T. Lewis
In reply to this post by dcorking
On Mon, Jul 24, 2006 at 11:11:44AM +0100, David Corking wrote:
> On 7/23/06, Alexandre Bergel <[hidden email]> wrote:
> >> Sorry, you can do this on unix based platforms, but not on windows.
> >> The Win32 version of OSPP is quite limited, and does not support
> >> the necessary command piping.
>
> I am puzzled.  Why is piping necessary to run 'ls -l /etc ;' ?

Well, strictly speaking it isn't. But assuming that you want to make
use of the stdout output from the process that is running the /bin/ls
command (and similarly for stdin and stderr if these are of interest),
and assuming that you want to use Squeak for this rather than some
sort of tacky file copying arrangement, then the natural thing to
do is to pipe the output of /bin/ls into a pipe that you can read
from Squeak.

Class PipeableOSProcess (part of the CommandShell package, not
OSProcess per se) does this. When running on a Unix platform, Unix
pipes are used for the connections. The endpoints of the pipes are
FileStreams to Squeak, so you can read and write to the external
process in a reasonable way.

Win32 provides a similar mechanism for anonymous pipes, and OSPP
for Win32 can create these pipes. However, back when I was trying
to get this to work (using my Win95 development system I'm afraid),
I never really got the pipe mechanism to work reliably. The pipes
need to be non-blocking, and this was the part I could not get right.
Thus the pipes that PipeableOSProcess uses to connect the /bin/ls
program to your Squeak image are not available on Windows.

This is all perfectly doable stuff, I just don't happen to have
stumbled across enough motivation to make it happen. At the time,
I just got sick of rebooting my PC after every compile/link/crash
cycle, but that probably would no longer be an issue with a more
up-to-date Windows platform. I have not tried it though.

> >Arg...
> >So, I will hack something. I will probably do a small program in Peal
> >or Ruby that open a socket and wait for commands to be sent through
> >this socket. Any better idea welcomed...
>
> I don't have any better ideas - but how about a worse one - how about
> compiling the unix OSProcess plugin (and unix vm) under cygwin?
> Perhaps it has never been done, but it may be fun to try.  Cygwin
> supports most of the unix/posix API.

Interesting idea. I can't say that it *wouldn't* work, and I'd certainly
like to hear about if it does :)

Dave


Reply | Threaded
Open this post in threaded view
|

Re: OSProcess?

Klaus D. Witzel
In reply to this post by Alexandre Bergel-2
On Mon, 24 Jul 2006 22:21:38 +0200, Alexandre Bergel wrote:

>> I don't have any better ideas - but how about a worse one - how about
>> compiling the unix OSProcess plugin (and unix vm) under cygwin?
>> Perhaps it has never been done, but it may be fun to try.

No, I have done it, recently, for the 3.8bx VM. Can send the hacked  
scripts if someone wants to save time.

>> Cygwin
>> supports most of the unix/posix API.

In a nightmare fashion, yes. It tries to translate everything into a .dll  
call to Win$$ so all Squeak plugins must be set to internal because most  
of them call back (which does seem to be a problem between .dll and its  
.exe on win$$ in general).

And, you'll have to use cygwin's (not so stable) X11. In particular, there  
is no lfb (linear frame buffer) offered other than by X11. And, Squeak  
(aio?) is very unstable under cygwin: it can be run without timer or else  
without mouse, one really has choice ;-)

/Klaus

> Humm.... May work. I will give a try soon...
>
> Thanks!
>
> Cheers,
> Alexandre



Reply | Threaded
Open this post in threaded view
|

Re: OSProcess?

Alexandre Bergel-2
>>> Cygwin
>>> supports most of the unix/posix API.
>
> In a nightmare fashion, yes. It tries to translate everything into  
> a .dll call to Win$$ so all Squeak plugins must be set to internal  
> because most of them call back (which does seem to be a problem  
> between .dll and its .exe on win$$ in general).
>
> And, you'll have to use cygwin's (not so stable) X11. In  
> particular, there is no lfb (linear frame buffer) offered other  
> than by X11. And, Squeak (aio?) is very unstable under cygwin: it  
> can be run without timer or else without mouse, one really has  
> choice ;-)

Oh...  I did a small java application that simply waits for serving a  
socket, and executes command that are passed through the socket...

Cheers,
Alexandre

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.cs.tcd.ie/Alexandre.Bergel
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.