Spawning an external app/process

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

Spawning an external app/process

Bill Schwab-2
Hello all,

Is there a conscensous on how to fire off an external app, and if desired,
capture its std stream outputs?  I found Bob Jarvis' code.  In the Dolphin
base, #system: is deprecated but does not suggest an alternative, though it
looks like #spawnForOutput: is the way to go????

Have a good one,

Bill

--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Spawning an external app/process

Don Rylander-3
Bill,
"Bill Schwab" <[hidden email]> wrote in message
news:b0s33j$t9am8$[hidden email]...
> Hello all,
>
> Is there a conscensous on how to fire off an external app, and if desired,
> capture its std stream outputs?  I found Bob Jarvis' code.  In the Dolphin
Do you mean Bob Jarvis' ExternalProcess package?  If so, that's what I've
been using for the last couple of months for stopping and restarting
services on a remote server (via sc.exe), and I've had no problems with it.
So far, however, I've always used it from the development image, so I can't
speak for whether there might be any runtime gotchas.

HTH,

Don

> base, #system: is deprecated but does not suggest an alternative, though
it

> looks like #spawnForOutput: is the way to go????
>
> Have a good one,
>
> Bill
>
> --
> Wilhelm K. Schwab, Ph.D.
> [hidden email]
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Spawning an external app/process

Bill Schwab-2
Don,

> > Is there a conscensous on how to fire off an external app, and if
desired,
> > capture its std stream outputs?  I found Bob Jarvis' code.  In the
Dolphin
> Do you mean Bob Jarvis' ExternalProcess package?

Yes and no.  I was looking at something else in his goodies, and
ExternalProcess was the basis for it.


> If so, that's what I've
> been using for the last couple of months for stopping and restarting
> services on a remote server (via sc.exe), and I've had no problems with
it.
> So far, however, I've always used it from the development image, so I
can't
> speak for whether there might be any runtime gotchas.

I started trying to get Dolphin to set up a service (via svrany.exe) for me,
by which I mean creating all of the registry entries. #spawnForOutput: seems
to work well enough to run the external programs, at least once I moved the
programs to directories that do not put spaces in the paths.  But, if you
have an easy solution to the whole problem, I'd enjoy knowing about it.

Have a good one,

Bill

--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Spawning an external app/process

Don Rylander-3
Bill,
"Bill Schwab" <[hidden email]> wrote in message
news:b0uat0$t4c18$[hidden email]...
> Don,
[...]
> I started trying to get Dolphin to set up a service (via svrany.exe) for
me,
> by which I mean creating all of the registry entries. #spawnForOutput:
seems
> to work well enough to run the external programs, at least once I moved
the
> programs to directories that do not put spaces in the paths.  But, if you
> have an easy solution to the whole problem, I'd enjoy knowing about it.
Sorry, but I haven't tried creating a service from one a Dolphin app,
although I did use svrany.exe a few years ago to make a compiled awk program
(of all things!) into a service.  IIRC (a big if), it was pretty
straightforward and worked pretty well.

One thing that might simplify things in your case is to use
File(class)>>shortPathOf: to create a DOS-like 8.3 path string for a
filespec.  It has some limitations (e.g., the volume has to support 8.3
filenames), but it might be worth looking at.

I think the big advantage of Bob's ExternalProcess mechanism is that it
doesn't open a window when the command executes.  I suppose there are other
ways around that, but since his approach works well for my purposes so far.
I don't specifically recall, but I wonder whether opening a window might be
a problem for an application running as a service in some circumstances.

Take care,

Don

>
> Have a good one,
>
> Bill
>
> --
> Wilhelm K. Schwab, Ph.D.
> [hidden email]
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Spawning an external app/process

Bob Jarvis
In reply to this post by Bill Schwab-2
"Bill Schwab" <[hidden email]> wrote in message news:<b0s33j$t9am8$[hidden email]>...
> Hello all,
>
> Is there a conscensous on how to fire off an external app, and if desired,
> capture its std stream outputs?  I found Bob Jarvis' code.  In the Dolphin
> base, #system: is deprecated but does not suggest an alternative, though it
> looks like #spawnForOutput: is the way to go????

Bill,

Sorry for the late follow-up.  I haven't been doing much Smalltalk
lately and haven't been watching this group as diligently as I'd like.

As best I can recall I looked at spawnForOutput: but found it didn't
do what I wanted.  Specifically, I wanted to be able to both

     A) wait synchronously for the external process to terminate
        or time out, then continue, and

     B) execute the external process asynchronously, optionally
        waiting for completion when convenient/necessary.

To do (B) I needed the process handle and couldn't figure out how to
get it.  CRTLibrary>>spawnvp:cmdname:args: also blocks the calling
VM-level process which I didn't want.  As such I dropped down to the
Win32 functions.  (In my own non-defense I'll note that as written
ExternalProcess blocks the whole dang VM when running a process
synchronously.  This is *not* a good thing, but it works for what I
wanted it for.  Of course, since it should take all of eight
characters to fix maybe I should fix it, eh?).

Have a good one.