Skip to content

Commit

Permalink
sh: Don't require the setting of POSIXLY_CORRECT on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
obiwac committed Nov 24, 2024
1 parent 7f26405 commit c41cd09
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ You can also just run any command you want by passing it to `bob sh`, like so:

```console
bob sh echo test
bob sh sh -c "echo \$PATH"
bob sh -- sh -c "echo \$PATH"
```

The second command will print out the value of the `$PATH` environment variable, and it should be prepended by the `bin` directory of the temporary installation prefix.
Expand Down
6 changes: 6 additions & 0 deletions src/bsys.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ int bsys_sh(bsys_t const* bsys, int argc, char* argv[]) {

else {
for (int i = 0; i < argc; i++) {
// On BSD/macOS, getopt doesn't consume the '--' argument.

if (strcmp(argv[i], "--") == 0) {
continue;
}

cmd_add(&cmd, argv[i]);
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/sh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if [ "$(bob sh echo test | tail -n1)" != "test" ]; then
exit 1
fi

if [ "$(bob sh sh -c "echo \$PATH" | tail -n1 | cut -d':' -f1)" != ".bob/prefix/bin" ]; then
if [ "$(bob sh -- sh -c "echo \$PATH" | tail -n1 | cut -d':' -f1)" != ".bob/prefix/bin" ]; then
echo "Temporary installation prefix not in \$PATH." >&2
exit 1
fi
Expand Down

0 comments on commit c41cd09

Please sign in to comment.