Hi
Today I've been playing with OSProcess and CommandShell, to see if they can give me the control I'd like for running external processes on Windows (XP, then later Vista). The VM I'm using is a somewhat customised Web-browser plugin based on 3.7. The image is a pretty heavily customised 3.7. The plugin I built today seems to be working, and with a bit of tweaking I've successfully launched batch-file commands from the Squeak shell or by talking directly to CommandShell. However, I'm having trouble figuring out which aspects of the overall (and impressive) Unix-oriented behaviour are supposedly available for Windows platforms. On the OSProcess web page it just says "The Windows support is not as complete as that for Unix, but it is sufficient for running external Win32 programs from Squeak." Ideally what I'd like to do is launch an executable (a Java application, typically invoked through a batch file) that listens for user-typed commands on stdin, and produces console-style responses. I'd like to throw commands at it from Squeak, listen for the corresponding results, then eventually shut it down. However, as things are: - CommandShell will happily start a command, but only if it includes redirections for both stdout and stderr. Otherwise I get walkbacks from two BufferedAsyncFileReadStream instances, which find themselves unable to run primTestEndOfFileFlag: - Even if I do provide stdout and stderr redirections, they don't actually receive any output from the running process. So - is it that ExternalPipes are (for now) completely unsupported for Windows? Or have I just managed to mess things up somewhere? If they're not available, I'm hoping I can hack something up using a Unix-style "tail" command to deliver the input, or some such scheme. That was the plan before I found these packages. Thanks - Aran -- Aran Lunzer Hokkaido University, Japan |
Hi,
> Ideally what I'd like to do is launch an executable (a Java application, > typically invoked through a batch file) that listens for user-typed > commands on stdin, and produces console-style responses. I'd like to > throw commands at it from Squeak, listen for the corresponding results, > then eventually shut it down. You might try the ProcessWrapper package. We tried it with the image and vm in http://ftp.squeak.org/3.7/win/Squeak3.7-current-win-full.zip on vista. You can use it like: p := ProcessWrapper new useStdout; startWithShellCommand: 'cat'; yourself. p writeToStdin: 'foo'. (p next: 3) = 'foo' It's available here: http://www.squeaksource.com/ProcessWrapper.html Cheers, Balázs |
In reply to this post by Aran Lunzer
Hello Bal�D+!zs - thanks for the pointer!
>> Ideally what I'd like to do is launch an executable (a Java application, >> typically invoked through a batch file) that listens for user-typed >> commands on stdin, and produces console-style responses. I'd like to >> throw commands at it from Squeak, listen for the corresponding results, >> then eventually shut it down. > >You might try the ProcessWrapper package. >We tried it with the image and vm in >http://ftp.squeak.org/3.7/win/Squeak3.7-current-win-full.zip on vista. > >You can use it like: > >p := ProcessWrapper new > useStdout; > startWithShellCommand: 'cat'; > yourself. >p writeToStdin: 'foo'. >(p next: 3) = 'foo' > >It's available here: http://www.squeaksource.com/ProcessWrapper.html So... I tried installing it, but none of my 3.7 images (on XP or on Vista) could work with the ready-built DLL. Not even the out-of-the-box 3.7 release. The 3.9 release image seemed much happier: the precise example you gave here didn't work as I was expecting, but the basic example on the SqueakSource summary page did: ProcessWrapper new useStdout; startWithShellCommand: 'echo hello'; upToEnd --> 'hello<cr>' Looking at the source code for the DLL, I'm afraid that at the level of my non-Squeak skills it would probably take me a day to rebuild it. Do you happen to have a 3.7-specific compiled DLL? Many thanks Aran |
Aran Lunzer wrote:
> Looking at the source code for the DLL, I'm afraid that at the level of my > non-Squeak skills it would probably take me a day to rebuild it. Do you > happen to have a 3.7-specific compiled DLL? It is extremely unlikely that the problem is with the DLL. More likely you are switching between VMs that are not compatible with this version. Try running your 3.7 images with a more recent VM and see if this works with the DLL in question. Cheers, - Andreas |
In reply to this post by Aran Lunzer
Hi!
> So... I tried installing it, but none of my 3.7 images (on XP or on Vista) > could work with the ready-built DLL. Not even the out-of-the-box 3.7 > release. The 3.9 release image seemed much happier: the precise example > you gave here didn't work as I was expecting, but the basic example on the > SqueakSource summary page did: > > ProcessWrapper new > useStdout; > startWithShellCommand: 'echo hello'; > upToEnd > > --> 'hello<cr>' > To make sure that the given example works as expected, you have to make sure that cat (cat.exe) is in the vm's search path, or you have to use the explicit path to the executable, like here: p := ProcessWrapper new useStdout; startWithCommand: 'C:\UnxUtils\usr\local\wbin\cat.exe'; yourself. p writeToStdin: 'foo'. self assert: (p next: 3) = 'foo'. p closeStdin. If you don't have cat.exe (because windows doesn't have it by default), you can download the unxutils package which contains it from: http://unxutils.sourceforge.net/ If you have cat.exe and touch.exe in the vm's search path, then you can run the tests in the package which should all be green. Cheers, Levente |
In reply to this post by Aran Lunzer
On Tue, Mar 24, 2009 at 11:54:11PM +0900, Aran Lunzer wrote:
> > So - is it that ExternalPipes are (for now) completely unsupported for > Windows? Or have I just managed to mess things up somewhere? Aran, Yes, this is exactly the case. OSProcess (hence CommandShell) currently has support for OS pipes on unix and Mac OS X, but not for Windows. Sorry for my late reply; I have been away on holiday and have been carefully avoiding anything resembling a computer or cell phone ;) Dave |
Free forum by Nabble | Edit this page |