comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Capturing output from SPAWN
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Capturing output [message #31282 is a reply to message #11565] Mon, 24 June 2002 13:27 Go to previous messageGo to previous message
Dave Greenwood is currently offline  Dave Greenwood
Messages: 33
Registered: October 2000
Member
In a previous article, "Ian Dean" <Ian.d.dean@baesystems.com> wrote:
> Hi,
> A long shot, as I'm using IDL 5.4 under OpenVMS 7.1.
>
> Is there a way of running a sub-process (perhaps using SPAWN) and capture
> its output as it happens to a text widget. I am aware I could use the RESULT
> keyword, but that is only available when the SPAWNed process completes.
>
> It may be possible to use a CALL_EXTERNAL using mailboxes to communicate,
> but this seems a bit heavy handed.

I think you're on the right track with mailboxes, but I don't think you
need to go so far as to use CALL_EXTERNAL. You should be able to SPAWN
(/NOWAIT) a subprocess to run a command procedure. The procedure creates
the mailbox, defines a job-wide logical containing the mailbox device
name and then runs the program with output directed to the mailbox. You
can OPENR the mailbox in IDL, read the output and write it to your text
widget.

The following is a slight modification of a procedure to create a mailbox
in DCL which was posted to comp.os.vms some years ago by Claude Barbe.
The modification simply defines the job-wide logical "output_mailbox".

$ SPAWN/NOLOG/NOSYMBOLS/NOLOGICAL_NAMES/PROCESS=DCLMBX_'F$getj pi( "","PID") -
ATTACH/IDENTIFICATION='F$getjpi("","PID")
$ X = F$context("PROCESS",CTX,"PRCNAM","DCLMBX_''F$getjpi("", "PID")'","EQL")
$ define/job output_mailbox _MBA'F$getjpi(F$pid(CTX),"TMBU")':
$ OPEN/READ/WRITE DCLMBX output_mailbox
$ STOP DCLMBX_'F$getjpi("","PID")

In IDL you can open the mailbox like this (the colon is required,
according to my test):

IDL> openr,lun,'output_mailbox:',/get_lun

BTW, does anyone know how to solve the original problem on Mac and/or
Windows?

Hth,
Dave

ps - I have a macro program, also from Claude, which creates a mailbox
which can be used from DCL. It's from pre-alpha days so I don't know if
it'll compile on alpha without mods or not. But it would have the benefit
of using an image activation instead of a process creation. Email me if
you're interested.

--------------
Dave Greenwood Email: Greenwoodde@ORNL.GOV
Oak Ridge National Lab %STD-W-DISCLAIMER, I only speak for myself
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: "Program Code area full" error message
Next Topic: Re: axis is too thin? - test.ps (0/1)

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 16:20:01 PDT 2025

Total time taken to generate the page: 0.48246 seconds