Skip to content

Commit c1c6ccc

Browse files
committed
Shell (Linux): fixes ash version detection
Fixes #2271
1 parent e252652 commit c1c6ccc

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/detection/terminalshell/terminalshell.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,10 @@ static bool getShellVersionNushell(FFstrbuf* exe, FFstrbuf* version) {
167167
}
168168

169169
static bool getShellVersionAsh(FFstrbuf* exe, FFstrbuf* version) {
170-
if (ffProcessAppendStdErr(version, (char* const[]) { exe->chars, "--help", NULL }) != NULL) {
170+
const char* error = ffStrbufEndsWithS(exe, "busybox")
171+
? ffProcessAppendStdErr(version, (char* const[]) { exe->chars, "ash", "--help", NULL })
172+
: ffProcessAppendStdErr(version, (char* const[]) { exe->chars, "--help", NULL });
173+
if (error != NULL) {
171174
return false;
172175
}
173176

@@ -268,7 +271,7 @@ bool fftsGetShellVersion(FFstrbuf* exe, const char* exeName, FFstrbuf* version)
268271
if (ffStrEqualsIgnCase(exeName, "elvish")) {
269272
return getExeVersionRaw(exe, version);
270273
}
271-
if (ffStrEqualsIgnCase(exeName, "ash")) {
274+
if (ffStrEqualsIgnCase(exeName, "ash") || ffStrEqualsIgnCase(exeName, "busybox")) {
272275
return getShellVersionAsh(exe, version);
273276
}
274277
if (ffStrEqualsIgnCase(exeName, "xonsh")) {

0 commit comments

Comments
 (0)