Skip to content

Commit 1a5997b

Browse files
pv42patrickelectric
authored andcommitted
feat: add check if git is installed, improve build error messages
1 parent 33af3d0 commit 1a5997b

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

mavlink/build/main.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ use std::process::{Command, ExitCode};
88
fn main() -> ExitCode {
99
let src_dir = Path::new(env!("CARGO_MANIFEST_DIR"));
1010

11+
// Check if git is installed
12+
if Command::new("git").arg("--version").status().is_err() {
13+
eprintln!("error: Git is not installed or could not be found.");
14+
return ExitCode::FAILURE;
15+
}
16+
1117
// Update and init submodule
1218
if let Err(error) = Command::new("git")
1319
.arg("submodule")
@@ -16,7 +22,7 @@ fn main() -> ExitCode {
1622
.current_dir(src_dir)
1723
.status()
1824
{
19-
eprintln!("{error}");
25+
eprintln!("Failed to update MAVLink definitions submodule: {error}");
2026
return ExitCode::FAILURE;
2127
}
2228

@@ -32,7 +38,7 @@ fn main() -> ExitCode {
3238
.current_dir(&mavlink_dir)
3339
.status()
3440
{
35-
eprintln!("{error}");
41+
eprintln!("Failed to apply MAVLink definitions patches: {error}");
3642
return ExitCode::FAILURE;
3743
}
3844
}

0 commit comments

Comments
 (0)