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

Home » Public Forums » archive » Help with 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: Help with Spawn [message #61542 is a reply to message #42260] Sat, 19 July 2008 12:53 Go to previous messageGo to previous message
jeffnettles4870 is currently offline  jeffnettles4870
Messages: 111
Registered: October 2006
Senior Member
On Jul 19, 9:22 am, Vince Hradil <hrad...@yahoo.com> wrote:
> On Jul 18, 7:37 pm, "Jeff N." <jeffnettles4...@gmail.com> wrote:
>
>
>
>> On Jul 18, 1:46 pm, Vince Hradil <hrad...@yahoo.com> wrote:
>
>>> On Jul 18, 12:24 pm, "Jeff N." <jeffnettles4...@gmail.com> wrote:
>
>>>> On Jul 18, 10:17 am, Vince Hradil <hrad...@yahoo.com> wrote:
>
>>>> > On Jul 18, 8:48 am, "Jeff N." <jeffnettles4...@gmail.com> wrote:
>
>>>> > > On Jul 18, 7:23 am, alex...@gmail.com wrote:
>
>>>> > > > Hello everybody. My question is simple, yet I haven't found a
>>>> > > > satisfying answer in the various guides.
>
>>>> > > > I'm using spawn to call for an executable file under the Windows OS,
>>>> > > > it oppens a command window and executes there. The problem is, very
>>>> > > > quickly I get an error and the entire command shell closes
>>>> > > > momentarily. I'd want  to be able to see the error it presents before
>>>> > > > closing the shell, or just leave it open.
>
>>>> > > > Is this possible? Is there any other way around it?
>
>>>> > > > Thanks a lot for any help, Alex
>
>>>> > > Another trick i do a lot is just print out the command that you're
>>>> > > going to spawn using a print statement, then open up your own command
>>>> > > window and paste in that command.  The command shell isn't going to
>>>> > > close when you do that, and I often find it's easier to fix whatever
>>>> > > mistakes i've made with the command i'm trying to issue in the actual
>>>> > > command window then go back to my IDL program and make sure it spawns
>>>> > > the fixed command.
>
>>>> > > Jeff
>
>>>> > How about using the LOG_OUTPUT keyword?  Simple is good...
>
>>>> I've actually had that keyword not work for me a few times.  It's
>>>> always been when the program i've tried to spawn was not an OS command
>>>> (e.g., dir, cd, etc.), and i think it was also a program where the
>>>> output wasn't outputting one line of text for each iteration but
>>>> rather doing a sequence like print output/clear screen/print output/
>>>> etc....
>
>>>> This was a long time ago and a minor issue so i just did the cut-and-
>>>> paste-the-spawn-string trick i mentioned earlier and then moved on :)
>>>> It would be good to know, though, if this is something anyone else has
>>>> run into...
>
>>> It works for me:
>
>>> IDL> cd, 'c:\temp'
>>> IDL> spawn, 'dir', /log_output
>>>  Volume in drive C has no label.
>>>  Volume Serial Number is 8C6A-7ADD
>
>>>  Directory of c:\temp
>
>>> 07/01/2008  11:23 AM    <DIR>          .
>>> 07/01/2008  11:23 AM    <DIR>          ..
>>>                0 File(s)              0 bytes
>>>                2 Dir(s)  12,076,867,584 bytes free
>>> IDL> print, !version
>>> { x86 Win32 Windows Microsoft Windows 7.0 Oct 25 2007      32      64}
>
>> Right, spawning a 'dir' command works for me too, as does any of the
>> other "internal" commands.  I just tried the command line version of
>> my sFTP program however, which is not part of what used to be DOS, and
>> the keyword does not work.  I'm guessing it has to do with the way
>> text is written to stout somehow?? Anyway this is on IDL 6.2 and WinXP
>> SP3.
>
> Oh, I see - I misread your earlier comment.  I thought you said it
> fails when it IS an internal command.
>
> Here's a little test I did with 7zip.
>
> IDL> cd, 'c:\temp'
> IDL> spawn, 'dir', /log_output
>  Volume in drive C has no label.
>  Volume Serial Number is 8C6A-7ADD
>
>  Directory of c:\temp
>
> 07/19/2008  08:18 AM    <DIR>          .
> 07/19/2008  08:18 AM    <DIR>          ..
> 07/19/2008  08:18 AM                 0 test.txt
>                1 File(s)              0 bytes
>                2 Dir(s)  12,129,624,064 bytes free
> IDL> spawn, 'c:\program files\7-Zip\7z.exe ', /log_output
> 'c:\program' is not recognized as an internal or external command,
> operable program or batch file.
> IDL> spawn, '"c:\program files\7-Zip\7z.exe"', /log_output
>
> 7-Zip  4.58 beta  Copyright (c) 1999-2008 Igor Pavlov  2008-05-05
>
> Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...]
>        [<@listfiles...>]
>
> <Commands>
>   a: Add files to archive
>   b: Benchmark
>   d: Delete files from archive
>   e: Extract files from archive (without using directory names)
>   l: List contents of archive
>   t: Test integrity of archive
>   u: Update files to archive
>   x: eXtract files with full paths
> <Switches>
>   -ai[r[-|0]]{@listfile|!wildcard}: Include archives
>   -ax[r[-|0]]{@listfile|!wildcard}: eXclude archives
>   -bd: Disable percentage indicator
>   -i[r[-|0]]{@listfile|!wildcard}: Include filenames
>   -m{Parameters}: set compression Method
>   -o{Directory}: set Output directory
>   -p{Password}: set Password
>   -r[-|0]: Recurse subdirectories
>   -scs{UTF-8 | WIN | DOS}: set charset for list files
>   -sfx[{name}]: Create SFX archive
>   -si[{name}]: read data from stdin
>   -slt: show technical information for l (List) command
>   -so: write data to stdout
>   -ssc[-]: set sensitive case mode
>   -ssw: compress shared files
>   -t{Type}: Set type of archive
>   -v{Size}[b|k|m|g]: Create volumes
>   -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options
>   -w[{path}]: assign Work directory. Empty path means a temporary
> directory
>   -x[r[-|0]]]{@listfile|!wildcard}: eXclude filenames
>   -y: assume Yes on all queries
> IDL> spawn, '"c:\program files\7-Zip\7z.exe" test.txt', /log_output
>
> 7-Zip  4.58 beta  Copyright (c) 1999-2008 Igor Pavlov  2008-05-05
>
> Error:
> Incorrect command line
> IDL> spawn, '"c:\program files\7-Zip\7z.exe" a -tgzip test.txt.gz
> test.txt', /log_output
>
> 7-Zip  4.58 beta  Copyright (c) 1999-2008 Igor Pavlov  2008-05-05
> Scanning
>
> Creating archive test.txt.gz
>
> Compressing  test.txt
>
> Everything is Ok
> IDL> spawn, 'dir', /log_output
>  Volume in drive C has no label.
>  Volume Serial Number is 8C6A-7ADD
>
>  Directory of c:\temp
>
> 07/19/2008  08:20 AM    <DIR>          .
> 07/19/2008  08:20 AM    <DIR>          ..
> 07/19/2008  08:18 AM                 0 test.txt
> 07/19/2008  08:20 AM                32 test.txt.gz
>                2 File(s)             32 bytes
>                2 Dir(s)  12,129,591,296 bytes free

I actually thought about using my zip program as a test too, but
unfortunately even if you run it from the command line it still opens
up a window to report its progress in. That's the only other command
line program i have anymore :( wow times have changed. Anyway, the
program itself works fine when i spawn it from IDL. IDL just doesn't
capture the output when you set log_output. I think your results
confirm my earlier suspicion: that it's the program being spawned,
not IDL (or Windows), that is causing something to happen that makes
IDL unable to capture its output.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: plot,lat,lon
Next Topic: Re: plot,lat,lon

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

Current Time: Sun Oct 12 09:46:13 PDT 2025

Total time taken to generate the page: 0.80115 seconds