Skip to content

Commit 39ea786

Browse files
committed
look for elm.exe on Windows
1 parent 3306537 commit 39ea786

File tree

1 file changed

+17
-2
lines changed
  • installers/npm/bin

1 file changed

+17
-2
lines changed

installers/npm/bin/elm

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,22 @@ var targetPath = fs.realpathSync(process.argv[1]);
2727
process.chdir(path.join(path.dirname(targetPath), ".."));
2828

2929
install(process.platform, process.arch).then(function() {
30-
spawn(targetPath, process.argv.slice(2), {
30+
// we have to do this because the Elm binaries end in `.exe` on
31+
// Windows. Really, we should fix this upstream (in binwrap), but in the
32+
// interests of getting the installers out we're going to do this temporarily
33+
// and ship a fix upstream later.
34+
var replacement = process.argv.slice(2);
35+
if (process.platform === "win32") {
36+
replacement += ".exe";
37+
38+
if (fs.existsSync(replacement)) {
39+
// if we replaced the bootstrap script, we should remove it. Otherwise we'd
40+
// have two of them laying around on Windows (elm and elm.exe)
41+
fs.unlinkSync(process.argv.slice(2));
42+
}
43+
}
44+
45+
spawn(targetPath, replacement, {
3146
stdio: "inherit"
3247
}).on("exit", process.exit);
33-
});
48+
});

0 commit comments

Comments
 (0)