diff --git a/source/dub/generators/generator.d b/source/dub/generators/generator.d index 48e10ec..a971664 100644 --- a/source/dub/generators/generator.d +++ b/source/dub/generators/generator.d @@ -813,7 +813,7 @@ auto depNames = proj.dependencies.map!((a) => a.name).array(); storeRecursiveInvokations(env, proj.rootPackage.name ~ depNames); - runCommands(commands, env); + runCommands(commands, env, pack.path().toString()); } private bool isRecursiveInvocation(string pack) diff --git a/source/dub/internal/utils.d b/source/dub/internal/utils.d index 043812d..88278cb 100644 --- a/source/dub/internal/utils.d +++ b/source/dub/internal/utils.d @@ -186,12 +186,12 @@ return fi.isDirectory; } -void runCommand(string command, string[string] env = null) +void runCommand(string command, string[string] env = null, string workDir = null) { - runCommands((&command)[0 .. 1], env); + runCommands((&command)[0 .. 1], env, workDir); } -void runCommands(in string[] commands, string[string] env = null) +void runCommands(in string[] commands, string[string] env = null, string workDir = null) { import std.stdio : stdin, stdout, stderr, File; @@ -213,7 +213,7 @@ foreach(cmd; commands){ logDiagnostic("Running %s", cmd); Pid pid; - pid = spawnShell(cmd, stdin, childStdout, childStderr, env, config); + pid = spawnShell(cmd, stdin, childStdout, childStderr, env, config, workDir); auto exitcode = pid.wait(); enforce(exitcode == 0, "Command failed with exit code " ~ to!string(exitcode) ~ ": " ~ cmd); diff --git a/test/issue1775/.no_run b/test/issue1775/.no_run new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/issue1775/.no_run diff --git a/test/issue1775/.no_test b/test/issue1775/.no_test new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/issue1775/.no_test diff --git a/test/issue1775/dub.json b/test/issue1775/dub.json new file mode 100644 index 0000000..5640e4a --- /dev/null +++ b/test/issue1775/dub.json @@ -0,0 +1,5 @@ +{ + "name": "test", + "targetName": "test-application", + "preBuildCommands": [ "[ -f issue1775.marker ]" ] +} diff --git a/test/issue1775/issue1775.marker b/test/issue1775/issue1775.marker new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/issue1775/issue1775.marker diff --git a/test/issue1775/source/app.d b/test/issue1775/source/app.d new file mode 100644 index 0000000..ab73b3a --- /dev/null +++ b/test/issue1775/source/app.d @@ -0,0 +1 @@ +void main() {}