D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1077 - writef and friends won't read/write from/to redirected std handles
Summary: writef and friends won't read/write from/to redirected std handles
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: bootcamp
Depends on:
Blocks:
 
Reported: 2007-03-21 12:03 UTC by Jascha Wetzel
Modified: 2021-05-18 17:42 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Jascha Wetzel 2007-03-21 12:03:22 UTC
on win32 writef and friends don't use redirected std handles if they are piped.
stdin/out/err handles 0, 1 and 2 are not the redirected versions on win32. one needs to get redirected handles with
GetStdHandle(STD_INPUT_HANDLE);
etc.

therefore, the std handles from std.c.stdio used in std.stdio probably cannot be constant.
Comment 1 Andrei Alexandrescu 2010-11-26 17:50:31 UTC
I'd work on this but don't have a Windows machine. Could someone else take this bug over? Also, is it reproducible on D2? Thanks.
Comment 2 anonymous4 2010-11-28 11:00:30 UTC
In fact, I have a working plugin that retabifies source, passed to stdin, though, as I see it uses my io streams that I wrote in order to fix bug 2742 :)
Comment 3 Andrei Alexandrescu 2011-06-05 08:08:20 UTC
I'm putting this up for grabs as I don't have a Windows system to test on.
Comment 4 Andrei Alexandrescu 2015-11-03 17:39:36 UTC
Is this bug still valid? Does it apply to D2?
Comment 5 Andrew Edwards 2021-05-18 17:40:57 UTC
Validated that this issue is resolved on both Win7 and Win10. No problems encountered after compiling with -m32 and piping output of resulting executable to file.