Redirect stdout of a Windows command line program under wine
4
votes
3
answers
3660
views
I run a Windows command line program (that I can not make accessible) with wine. It apparently writes something to stdout and I'm trying to capture that output, but I can't redirect it.
No matter if I redirect stdout or stderr to a file, the program output is still printed on the console and is not written to the file. When I redirect stderr, the wine output goes away, but the program's output is stilled printed on screen.
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
If I redirect both, the output is neither printed on screen nor written to the file.
**Edit:** On Windows, behavior is similar, but when redirecting both, everything is still printed on screen.
Here are some examples with the complete output.
$ 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
When I try to redirect the output, this happens:
$ 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
I.e., the program's console output is completely missing. The program still works fine and writes some files it's supposed to write. As a check, I did the same with pngcrush, and I get what I'd expect. Without redirection:
$ 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
With redirection:
$ 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
What could be the cause of that not working for the other program?
wine stdout stderr io-redirection
Asked by Thomas W.
(323 rep)
Dec 8, 2016, 12:48 PM
Last activity: May 20, 2025, 09:40 AM
Last activity: May 20, 2025, 09:40 AM