import std.process; void main() { char[] chBuffer = new char[](256); chBuffer[] = '\0'; chBuffer[0..3] = "dir".dup; auto result = shell(chBuffer.idup); }
It does two things: 1. It prints out the result of the shell invocation to stdout. This shouldn't happen. 2. It throws this: std.file.FileException@std\file.d(295): 5a5785b9a9ef300e292f021170a6bb2e34b80c86bb8decbb6b9b8d3b5e852cd This sample works: import std.process; void main() { string chBuffer = "dir"; auto result = shell(chBuffer); } Here the shell invocation isn't printed to the screen, but stored in result like it should be. The problem is I'm working with the win32 API and I can't use lovely D strings. I've tried using to!string and .idup on the call to 'shell', I've tried appending null's to the char[] but nothing seems to help. What am I doing wrong?