Skip to content

Commit

Permalink
AP_HAL_SITL: work around bug in dash
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker committed Aug 3, 2024
1 parent 8fd9946 commit 53d5c0d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion libraries/AP_HAL_SITL/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ static void run_command_on_ownpid(const char *commandname)
p = progname;
}

// work around a bug in dash; its manpage says it searches $PATH
// but it does't. https://github.com/ArduPilot/ardupilot/issues/24245
const char *cmd_fmt = "sh %s %d >%s 2>&1";
if (getenv("AP_DASH_HACKERY")) {
cmd_fmt = "sh -c \"%s %d\" >%s 2>&1";
}

char output_filepath[80];
snprintf(output_filepath,
ARRAY_SIZE(output_filepath),
Expand All @@ -106,7 +113,7 @@ static void run_command_on_ownpid(const char *commandname)
char cmd[200];
snprintf(cmd,
sizeof(cmd),
"sh %s %d >%s 2>&1",
cmd_fmt,
command_filepath,
(int)getpid(),
output_filepath);
Expand Down

0 comments on commit 53d5c0d

Please sign in to comment.