1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:17:35 +00:00

man: Use /bin/Shell as shell in non-POSIX mode

This fixes an issue where man breaks if you symlink `sh` to a different
shell because:
1: The target of the symlink isn't `unveil`ed.
2: The option `--skip--shellrc` isn't understood by other shells while
   at the same time being required for Shell when invoked in POSIX
   compatibility mode.

This also restores the shell used by man to the non-POSIX mode as before
beaae6b420.
This commit is contained in:
Oskar Skog 2023-06-07 13:07:14 +03:00 committed by Andreas Kling
parent b863332415
commit edd847798a

View file

@ -23,7 +23,7 @@
static ErrorOr<pid_t> pipe_to_pager(DeprecatedString const& command)
{
char const* argv[] = { "sh", "--skip-shellrc", "-c", command.characters(), nullptr };
char const* argv[] = { "Shell", "-c", command.characters(), nullptr };
auto stdout_pipe = TRY(Core::System::pipe2(O_CLOEXEC));
@ -31,7 +31,7 @@ static ErrorOr<pid_t> pipe_to_pager(DeprecatedString const& command)
posix_spawn_file_actions_init(&action);
posix_spawn_file_actions_adddup2(&action, stdout_pipe[0], STDIN_FILENO);
pid_t pid = TRY(Core::System::posix_spawnp("sh"sv, &action, nullptr, const_cast<char**>(argv), environ));
pid_t pid = TRY(Core::System::posix_spawnp("/bin/Shell"sv, &action, nullptr, const_cast<char**>(argv), environ));
posix_spawn_file_actions_destroy(&action);
TRY(Core::System::dup2(stdout_pipe[1], STDOUT_FILENO));