Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.scripting.vbscript > #12281

using wshell.exec causes lockup while reading the output - what to do ?

From "R.Wieser" <address@not.available>
Newsgroups microsoft.public.scripting.vbscript
Subject using wshell.exec causes lockup while reading the output - what to do ?
Date 2020-06-17 14:32 +0200
Organization Aioe.org NNTP Server
Message-ID <rcd2h8$trv$1@gioia.aioe.org> (permalink)

Show all headers | View raw


Hello all

I'm running a console-based windows program, and need to capture its output. 
When I try to use the "exec" method than, nomatter what I try, something 
locks up.

My code is basically this:

Set oExec = WshShell.Exec(sCmd)
Do While oExec.Status = 0
     WScript.Sleep 100
     wscript.echo oExec.stdout.readall
Loop

As the program also outputs on stderr I've changed the above reading of 
stdout with

if not oExec.stdout.atendofstream then wscript.echo oExec.stdout.read(1000)
if not oExec.stderr.atendofstream then wscript.echo oExec.stderr.read(1000)

But no matter what I've tried (small buffers, large buffers), at some point 
in the output it locks up. :-(

Apart from switching to the "run" method*, what can I do ?

*I've got the "run" method working.  But the output capturing needs the use 
of "cmd /e ", which in turn causes my screen to go black a few times 
(mutiple calls) with no (progress) output on it.  Not nice.

Regards,
Rudy Wieser

Back to microsoft.public.scripting.vbscript | Previous | NextNext in thread | Find similar | Unroll thread


Thread

using wshell.exec causes lockup while reading the output - what to do ? "R.Wieser" <address@not.available> - 2020-06-17 14:32 +0200
  Re: using wshell.exec causes lockup while reading the output - what to do ? "Mayayana" <mayayana@invalid.nospam> - 2020-06-17 08:48 -0400
  Re: using wshell.exec causes lockup while reading the output - what to do ? JJ <jj4public@vfemail.net> - 2020-06-17 22:12 +0700
    Re: using wshell.exec causes lockup while reading the output - what to do ? "R.Wieser" <address@not.available> - 2020-06-17 18:51 +0200
      Re: using wshell.exec causes lockup while reading the output - what to do ? JJ <jj4public@vfemail.net> - 2020-06-18 19:42 +0700
        Re: using wshell.exec causes lockup while reading the output - what to do ? "R.Wieser" <address@not.available> - 2020-06-18 17:26 +0200
          Re: using wshell.exec causes lockup while reading the output - what to do ? JJ <jj4public@vfemail.net> - 2020-06-19 21:16 +0700
            Re: using wshell.exec causes lockup while reading the output - what to do ? "R.Wieser" <address@not.available> - 2020-06-19 19:08 +0200
              Re: using wshell.exec causes lockup while reading the output - what to do ? JJ <jj4public@vfemail.net> - 2020-06-20 22:40 +0700
                Re: using wshell.exec causes lockup while reading the output - what to do ? "R.Wieser" <address@not.available> - 2020-06-20 18:56 +0200
                Re: using wshell.exec causes lockup while reading the output - what to do ? JJ <jj4public@vfemail.net> - 2020-06-21 12:33 +0700
                Re: using wshell.exec causes lockup while reading the output - what to do ? "R.Wieser" <address@not.available> - 2020-06-21 08:53 +0200
                Re: using wshell.exec causes lockup while reading the output - what to do ? JJ <jj4public@vfemail.net> - 2020-06-21 20:58 +0700
                Re: using wshell.exec causes lockup while reading the output - what to do ? "R.Wieser" <address@not.available> - 2020-06-21 17:46 +0200

csiph-web