delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/11/15/19:32:13

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4B00A0EE.7070101@gmail.com>
Date: Mon, 16 Nov 2009 00:46:38 +0000
From: Dave Korn <dave DOT korn DOT cygwin AT googlemail DOT com>
User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: How to capture stderr of dos process running in bash shell??
References: <26341304 DOT post AT talk DOT nabble DOT com> <4AFE14EB DOT 5020305 AT gmail DOT com> <20091114185556 DOT GA15089 AT ednor DOT casa DOT cgf DOT cx> <4AFF05F3 DOT 5060706 AT gmail DOT com> <26354920 DOT post AT talk DOT nabble DOT com>
In-Reply-To: <26354920.post@talk.nabble.com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

aputerguy wrote:
> Dave Korn writes:

> Yes the output (both stderr and stdout) appear on screen
> 
>> I checked: you can't redirect its error output at all, even in a genuine
>>  cmd.exe shell with cygwin having nothing to do with it. It must indeed
>> be using the console directly. <checks imports> Curiouser and
>> curiouser... it links msvcrt.dll and imports printf and wprintf, but then
>> it goes and actually does everything the hard way with lowlevel console
>> i/o in unicode. How peculiar.
> 
> Strange. What is meant then by this sentence included in the help:
>        "SubInAcl error messages are sent to the Standard error."

  I have no idea to be honest.  Maybe there is some third kind of output that
we haven't seen yet, but the only thing I could figure out how to redirect was
stdout, and the only error messages I could get it to produce went either to
that or direct to the console, e.g. (when running as a limited user):

> C:\WINNT>subinacl /file $NtUninstallKB888111W2k$ >\temp\stdout.guest 2>\temp\std
> err.guest
> 
> Elapsed Time: 00 00:00:00
> Done:        1, Modified        0, Failed        1, Syntax errors        0
> Last Done  : C:\WINNT\$NtUninstallKB888111W2k$
> Last Failed: C:\WINNT\$NtUninstallKB888111W2k$ - CreateFile Error : 1314 A requi
> red privilege is not held by the client.
> 
> C:\WINNT>type \temp\stderr.guest
> 
> C:\WINNT>type \temp\stdout.guest
>   e S e c u r i t y P r i v i l e g e   :   A c c e s s   i s   d e n i e d .
^^^^^^
> 
>  W A R N I N G   : U n a b l e   t o   s e t   S e S e c u r i t y P r i v i l e
>  g e   p r i v i l e g e .   T h i s   p r i v i l e g e   m a y   b e   r e q u
>  i r e d .
>  C : \ W I N N T \ $ N t U n i n s t a l l K B 8 8 8 1 1 1 W 2 k $   -   C r e a
>  t e F i l e   E r r o r   :   1 3 1 4   A   r e q u i r e d   p r i v i l e g e
>    i s   n o t   h e l d   b y   t h e   c l i e n t .
> 
> 
> 
> C:\WINNT>

  So, it just doesn't work, and that's using all MS software; it's not going
to work any better in bash.  I think you're probably out of luck here; I don't
know any way to capture direct console output like that (short of some sort of
screen scraper or even if you want a wooden table solution taking a snapshot
and OCRing it...!)

    cheers,
      DaveK


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019