std.process spawnShell/pipeShell dont capture output of the shell
Geert via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Sep 10 21:44:51 PDT 2016
I'm sorry for the "necro-bumping", but I've not found the
solution for this yet, and i'm getting a different error message
at the execution moment:
"std.stdio.StdioException@/build/ldc/src/ldc/runtime/phobos/std/stdio.d(4066): Bad file descriptor"
This is my testing code:
module dd_test;
import std.stdio, core.stdc.stdlib;
import std.process, std.string;
int main(string[] args) {
string command_find = "(find /usr/share/icons/ -name a*) ";
//string command_dd = "(dd if=/dev/urandom | pv -ptrbef -i 2
-s 2339876653 | dd of=/dev/null) 2>&1";
auto p = pipeShell(command_find, Redirect.all);
foreach(str; p.stdin.byLine){
writefln("IN: %s", str);
}
foreach(str; p.stdout.byLine){
writefln("OUT: %s", str);
}
foreach(str; p.stderr.byLine){
writefln("Error: %s", str);
}
return 0;
}
More information about the Digitalmars-d-learn
mailing list