xxxxxxxxxx
void main()
{
import std.process;
import std.exception;
const res1 = execute(["clang", "-v", "-xc++", "/dev/null", "-fsyntax-only"], ["LANG": "C"])
.ifThrown((e) {
import std.typecons : Tuple;
return Tuple!(int, "status", string, "output")(-1, e.msg);
}); // Fails
const res2 = () {
try
{
return execute(["clang", "-v", "-xc++", "/dev/null", "-fsyntax-only"], ["LANG": "C"]);
}
catch (Exception e)
{
import std.typecons : Tuple;
return Tuple!(int, "status", string, "output")(-1, e.msg);
}
}();
}