Skip to content

Commit

Permalink
Pass all remaining args to the script for "dub [file].d" invocations. F…
Browse files Browse the repository at this point in the history
…ixes #856.
  • Loading branch information
s-ludwig committed Jun 7, 2016
1 parent 6cc5055 commit 90299db
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion source/dub/commandline.d
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ int runDubCommandLine(string[] args)
if (args.length >= 1 && !args[0].startsWith("-")) {
if (args[0].endsWith(".d")) {
cmdname = "run";
args = "--single" ~ args;
if (app_args.length) app_args = args[1 .. $] ~ "--" ~ app_args;
else app_args = args[1 .. $];
args = ["--single", args[0]];
} else {
cmdname = args[0];
args = args[1 .. $];
Expand Down
3 changes: 2 additions & 1 deletion test/issue103-single-file-package.d
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
+/
module hello;

void main()
void main(string[] args)
{
import std.stdio : writeln;
assert(args.length == 4 && args[1 .. 4] == ["foo", "--", "bar"]);
writeln("Hello, World!");
}
2 changes: 1 addition & 1 deletion test/issue103-single-file-package.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
set -e
cd ${CURR_DIR}
./issue103-single-file-package.d
./issue103-single-file-package.d foo -- bar
${DUB} run --single issue103-single-file-package-json.d --compiler=${DC}
${DUB} issue103-single-file-package-w-dep.d --compiler=${DC}

0 comments on commit 90299db

Please sign in to comment.