Skip to content

Commit

Permalink
Fix running argbash on MacOS
Browse files Browse the repository at this point in the history
argbash uses `#!/bin/bash`. On MacOS, this means the MacOS version of bash will
be used. This wasn't a problem in the past, but it appears to be an issue now
(maybe because of a change to one of the recent Gradle versions, or maybe
because of a recent MacOS update). When MacOS bash was used, argbash would fail
with a syntax error. This is because it uses bash features that are not
available in the MacOS version of bash.

The solution is to use /usr/bin/env bash to invoke argbash, which then uses
whatever version of bash is first on the system path. For MacOS developers,
this will be a more recent GNU version of bash.
  • Loading branch information
jthurne committed May 2, 2024
1 parent f4180da commit 3aee4b4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/ApplyArgbash.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ abstract class ApplyArgbash @Inject constructor(

logger.info("Applying argbash to $file")
execOperations.exec {
commandLine(argbash, file, "-o", outputFile)
commandLine("/usr/bin/env", "bash", argbash, file, "-o", outputFile)
}
}
}
Expand Down

0 comments on commit 3aee4b4

Please sign in to comment.