Redirecionar stdout de um programa de linha de comando do Windows em wine

2

Eu corro um programa de linha de comando do Windows (que eu não posso tornar acessível) com vinho. Aparentemente, escreve algo para stdout e eu estou tentando capturar essa saída, mas não posso redirecioná-lo.

Não importa se eu redireciono stdout ou stderr para um arquivo, a saída do programa ainda é impressa no console e não é gravada no arquivo. Quando eu redireciono stderr, a saída do vinho desaparece, mas a saída do programa é impressa na tela.

wine program.exe > out   # File is empty, program output printed on screen
wine program.exe 2> out  # Wine output gets redirected to file, program output still printed on screen

Se eu redirecionar ambos, a saída não será impressa na tela nem gravada no arquivo.

Editar: No Windows, o comportamento é semelhante, mas ao redirecionar ambos, tudo ainda é impresso na tela.

Aqui estão alguns exemplos com a saída completa.

$ wine program.exe
fixme:winediag:start_process Wine Staging 1.9.23 is a testing version containing experimental patches.
fixme:winediag:start_process Please mention your exact version when filing bug reports on winehq.org.

output by program.exe

fixme:msvcrt:__clean_type_info_names_internal (0x100aaa54) stub

Quando tento redirecionar a saída, isso acontece:

$ wine program.exe > out 2>&1
$ cat out
fixme:winediag:start_process Wine Staging 1.9.23 is a testing version containing experimental patches.
fixme:winediag:start_process Please mention your exact version when filing bug reports on winehq.org.
fixme:msvcrt:__clean_type_info_names_internal (0x100aaa54) stub

Ou seja, a saída do console do programa está completamente ausente. O programa ainda funciona bem e escreve alguns arquivos que ele deveria escrever. Como um cheque, fiz o mesmo com o pngcrush e obtive o que esperava. Sem redirecionamento:

$ wine pngcrush_1_8_10_w32.exe test.png out.png
fixme:winediag:start_process Wine Staging 1.9.23 is a testing version containing experimental patches.
fixme:winediag:start_process Please mention your exact version when filing bug reports on winehq.org.

 | pngcrush-1.8.10
 |    Copyright (C) 1998-2002, 2006-2016 Glenn Randers-Pehrson
 |    Portions Copyright (C) 2005 Greg Roelofs
 | This is a free, open-source program.  Permission is irrevocably
 | granted to everyone to use this version of pngcrush without
 | payment of any fee.
 | Executable name is pngcrush_1_8_10_w32.exe
 | It was built with   bundled libpng-1.6.26
 | and is running with bundled libpng-1.6.26
 |    Copyright (C) 1998-2004, 2006-2016 Glenn Randers-Pehrson,
 |    Copyright (C) 1996, 1997 Andreas Dilger,
 |    Copyright (C) 1995, Guy Eric Schalnat, Group 42 Inc.,
 | and bundled zlib-1.2.8.1-motley, Copyright (C) 1995 (or later),
 |    Jean-loup Gailly and Mark Adler,
 | and using "clock()".
 | It was compiled with gcc version 4.8.0 20121015 (experimental).

  Recompressing IDAT chunks in test.png to out.png
   Total length of data found in critical chunks            =    431830
   Critical chunk length, method   1 (ws 15 fm 0 zl 4 zs 0) =    495979
   Critical chunk length, method   2 (ws 15 fm 1 zl 4 zs 0) >    495979
   Critical chunk length, method   3 (ws 15 fm 5 zl 4 zs 1) =    495354
   Critical chunk length, method   6 (ws 15 fm 5 zl 9 zs 0) =    457709
   Critical chunk length, method   9 (ws 15 fm 5 zl 2 zs 2) >    457709
   Critical chunk length, method  10 (ws 15 fm 5 zl 9 zs 1) =    451813
   Best pngcrush method        =  10 (ws 15 fm 5 zl 9 zs 1) =    451813
     (4.63% critical chunk increase)
     (4.63% filesize increase)

CPU time decode 4.407583, encode 17.094248, other 4294967296.000000, total 17.180143 sec

Com redirecionamento:

$ wine pngcrush_1_8_10_w32.exe test.png out.png > out 2>&1
$ cat out
fixme:winediag:start_process Wine Staging 1.9.23 is a testing version containing experimental patches.
fixme:winediag:start_process Please mention your exact version when filing bug reports on winehq.org.

 | pngcrush-1.8.10
 |    Copyright (C) 1998-2002, 2006-2016 Glenn Randers-Pehrson
 |    Portions Copyright (C) 2005 Greg Roelofs
 | This is a free, open-source program.  Permission is irrevocably
 | granted to everyone to use this version of pngcrush without
 | payment of any fee.
 | Executable name is pngcrush_1_8_10_w32.exe
 | It was built with   bundled libpng-1.6.26
 | and is running with bundled libpng-1.6.26
 |    Copyright (C) 1998-2004, 2006-2016 Glenn Randers-Pehrson,
 |    Copyright (C) 1996, 1997 Andreas Dilger,
 |    Copyright (C) 1995, Guy Eric Schalnat, Group 42 Inc.,
 | and bundled zlib-1.2.8.1-motley, Copyright (C) 1995 (or later),
 |    Jean-loup Gailly and Mark Adler,
 | and using "clock()".
 | It was compiled with gcc version 4.8.0 20121015 (experimental).

  Recompressing IDAT chunks in test.png to out.png
   Total length of data found in critical chunks            =    431830
   Critical chunk length, method   1 (ws 15 fm 0 zl 4 zs 0) =    495979
   Critical chunk length, method   2 (ws 15 fm 1 zl 4 zs 0) >    495979
   Critical chunk length, method   3 (ws 15 fm 5 zl 4 zs 1) =    495354
   Critical chunk length, method   6 (ws 15 fm 5 zl 9 zs 0) =    457709
   Critical chunk length, method   9 (ws 15 fm 5 zl 2 zs 2) >    457709
   Critical chunk length, method  10 (ws 15 fm 5 zl 9 zs 1) =    451813
   Best pngcrush method        =  10 (ws 15 fm 5 zl 9 zs 1) =    451813
     (4.63% critical chunk increase)
     (4.63% filesize increase)

CPU time decode 4.339310, encode 17.137527, other 4.294083, total 17.182100 sec

Qual poderia ser a causa disso não funcionar para o outro programa?

stdout stderout io-redirection do vinho

    
por Thomas W. 08.12.2016 / 13:48

0 respostas