This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to capture stderr of dos process running in bash shell??


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]