Use executeShell() to invoke the compiler. See #356.
execute() doesn't support running scripts with shebang lines. Still needs to be actually tested with a script on Linux/OS X.
1 parent a2d58f7 commit 683fb7427e91a2e1070dfcafe9129e0da145d424
@Sönke Ludwig Sönke Ludwig authored on 22 Jun 2014
Showing 4 changed files
View
8
source/dub/compilers/compiler.d
}
 
version (Posix) {
try {
auto pkgconfig_bin = "pkg-config";
enum pkgconfig_bin = "pkg-config";
string[] pkgconfig_libs;
foreach (lib; settings.libs)
if (execute([pkgconfig_bin, "--exists", "lib"~lib]).status == 0)
pkgconfig_libs ~= lib;
 
logDiagnostic("Using pkg-config to resolve library flags for %s.", pkgconfig_libs.map!(l => "lib"~l).array.join(", "));
 
if (pkgconfig_libs.length) {
auto libflags = execute(["pkg-config", "--libs"] ~ pkgconfig_libs.map!(l => "lib"~l)().array());
auto libflags = execute([pkgconfig_bin, "--libs"] ~ pkgconfig_libs.map!(l => "lib"~l)().array());
enforce(libflags.status == 0, format("pkg-config exited with error code %s: %s", libflags.status, libflags.output));
foreach (f; libflags.output.split()) {
if (f.startsWith("-Wl,")) settings.addLFlags(f[4 .. $].split(","));
else settings.addLFlags(f);
protected final void invokeTool(string[] args, void delegate(int, string) output_callback)
{
int status;
if (output_callback) {
auto result = execute(args);
auto result = executeShell(escapeShellCommand(args));
output_callback(result.status, result.output);
status = result.status;
} else {
auto compiler_pid = spawnProcess(args);
auto compiler_pid = spawnShell(escapeShellCommand(args));
status = compiler_pid.wait();
}
enforce(status == 0, args[0] ~ " failed with exit code "~to!string(status));
}
View
2
■■■
source/dub/compilers/dmd.d
case "x86_64": arch_flags = ["-m64"]; break;
}
settings.addDFlags(arch_flags);
 
auto result = execute(compiler_binary ~ arch_flags ~ ["-quiet", "-run", fil.toNativeString()]);
auto result = executeShell(escapeShellCommand(compiler_binary ~ arch_flags ~ ["-quiet", "-run", fil.toNativeString()]));
enforce(result.status == 0, format("Failed to invoke the compiler %s to determine the build platform: %s",
compiler_binary, result.output));
 
auto build_platform = readPlatformProbe(result.output);
View
source/dub/compilers/gdc.d
View
source/dub/package_.d