In the forked process, the array "pfds" is allocated and is never free'd.
That's a problem if you're going to spawn and keep running a lot of processes, since it's a quite big array.
`sysErrorString` throws an exception for unknown error codes (e.g. from
libraries using `SetLastError`) and hence could hide the actual error
that caused the call to `sysErrorString`.
The new helper function wraps the error code lookup and returns `Error X`
on failure.
This ensures that the actual error message won't be suppressed when the
lookup error code => message fails. The exception will also be more
informative because `WindowsException` is explicitly intended for
Windows API errors.
combines the very common constraint
`isInputRange!R && !isInfinite!R && isSomeChar!(ElementEncodingType!R)`
and adds a bunch of documentation with examples for users to understand
it better. This should lower the neccessary needed technical insight to
read basic docs, especially std.path and std.file docs.
Previously, if this call to 'open' failed, it would result in a spurious
test failure. Now, it instead causes the test to be skipped.
Possibly related to https://issues.dlang.org/show_bug.cgi?id=22350
`wait(Pid, Duration)` allows to wait until the process terminates
or the timeout expires.
It's currently windows-only because a decent posix implementation
is quite difficult and this allows us to sort out the API beforehand.
The temporary buffer returned by `tempCString` was assigned to a `char*`
and hence destroyed after the statement. This worked by accident for
small URL's because the space was allocated on the stack and not
overwritten before forking.
- Perform idup caching on all platforms (on Windows it also avoids
eliding conversion to UTF-8)
- Make getImpl more reusable
- Reduce redundancy between get / opIndex
Environment.remove cannot be @safe due to its use of the C functions
SetEnvironmentVariableW and unsetenv, and doesn't have sufficient
functionality to encapsulate the non-@safe fragments.
On Windows, the message for this common error case wasn't as informative
as it should be:
Failed to spawn new process (The system cannot find the file specified.)
Handle this just like on POSIX via a message like:
Executable file not found: 7z.exe
Also include the program name on POSIX if it contains a path (a dir
separator) - `Failed to execute program (No such file or directory)` =>
`Failed to execute './program' (No such file or directory)`.