Skip to content

Commit 13eadf9

Browse files
committed
[dirty impl] shitcode pt2 rebar.cmd
1 parent 87c9efb commit 13eadf9

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

crates/erlang_service/build.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,16 @@ fn main() {
2424
.expect("Copying precompiled erlang service escript failed");
2525
} else {
2626
let profile = env::var("PROFILE").unwrap();
27-
let output = Command::new("rebar3")
27+
28+
let mut cmd = if cfg!(target_os = "windows") {
29+
let mut cmd = Command::new("cmd");
30+
cmd.args(["/C", "rebar3"]);
31+
cmd
32+
} else {
33+
Command::new("rebar3")
34+
};
35+
36+
let output = cmd
2837
.arg("escriptize")
2938
.env("REBAR_PROFILE", &profile)
3039
.env("REBAR_BASE_DIR", &dest_dir)

crates/project_model/src/lib.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,15 @@ impl Project {
979979
rebar_setting.config_file
980980
);
981981
let rebar_version = {
982-
let mut cmd = Command::new("rebar3");
982+
983+
let mut cmd = if cfg!(target_os = "windows") {
984+
let mut cmd = Command::new("cmd");
985+
cmd.args(["/C", "rebar3"]);
986+
cmd
987+
} else {
988+
Command::new("rebar3")
989+
};
990+
983991
cmd.arg("version");
984992
utf8_stdout(&mut cmd)?
985993
};

crates/project_model/src/rebar.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,15 @@ impl RebarConfig {
7373
static ref REBAR_GLOBAL_LOCK: Mutex<()> = Mutex::new(());
7474
}
7575
let guard = REBAR_GLOBAL_LOCK.lock();
76-
let mut cmd = Command::new("rebar3");
76+
77+
let mut cmd = if cfg!(target_os = "windows") {
78+
let mut cmd = Command::new("cmd");
79+
cmd.args(["/C", "rebar3"]);
80+
cmd
81+
} else {
82+
Command::new("rebar3")
83+
};
84+
7785
cmd.arg("as");
7886
cmd.arg(&self.profile.0);
7987
if let Some(parent) = self.config_file.parent() {

0 commit comments

Comments
 (0)