-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue dlang#2190 - windows: dub won't run if TEMP is unset or empty
- Loading branch information
Showing
2 changed files
with
71 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/+ dub.json: { | ||
"name": "issue2190_unset_TEMP" | ||
} +/ | ||
|
||
module issue2190_unset_TEMP.script; | ||
|
||
int main() | ||
{ | ||
import std.stdio; | ||
import std.algorithm; | ||
import std.path; | ||
import std.process; | ||
|
||
const dir = __FILE_FULL_PATH__.dirName(); | ||
|
||
// doesn't matter, just pick something | ||
const file = buildPath(dir, "single-file-sdl-default-name.d"); | ||
|
||
const dub = environment.get("DUB", buildPath(dirName(dir), "bin", "dub.exe")); | ||
|
||
int exitCode; | ||
|
||
void runTest(scope const string[] cmd) | ||
{ | ||
const result = execute(cmd); | ||
|
||
if (result.status || result.output.canFind("Failed")) | ||
{ | ||
writefln("\n> %-(%s %)", cmd); | ||
writeln("==========================================================="); | ||
writeln(result.output); | ||
writeln("==========================================================="); | ||
writeln("Last command failed with exit code ", result.status, '\n'); | ||
exitCode = 1; | ||
} | ||
} | ||
|
||
environment.remove("TEMP"); | ||
|
||
// only guaranteed to be there on Windows | ||
// See: runDubCommandLine in commandline | ||
version(Windows) | ||
{ | ||
runTest([ | ||
dub, "build", | ||
"--single", file, | ||
]); | ||
} | ||
|
||
return exitCode; | ||
} |