1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-16 14:27:38 +00:00

Shell: Don't try to cast NonnullRefPtrs when priting debug output

Fixes a regression from 8a48246e.
This commit is contained in:
implicitfield 2023-10-21 22:21:49 +04:00 committed by Ali Mohammad Pur
parent 54e1470467
commit 2745b48e16

View file

@ -1042,17 +1042,17 @@ Vector<NonnullRefPtr<Job>> Shell::run_commands(Vector<AST::Command>& commands)
for (auto& command : commands) { for (auto& command : commands) {
if constexpr (SH_DEBUG) { if constexpr (SH_DEBUG) {
dbgln("Command"); dbgln("Command");
for (auto& arg : command.argv) for (auto const& arg : command.argv)
dbgln("argv: {}", arg); dbgln("argv: {}", arg);
for (auto& redir : command.redirections) { for (auto const& redir : command.redirections) {
if (redir->is_path_redirection()) { if (redir->is_path_redirection()) {
auto path_redir = (const AST::PathRedirection*)&redir; auto path_redir = (const AST::PathRedirection*)redir.ptr();
dbgln("redir path '{}' <-({})-> {}", path_redir->path, (int)path_redir->direction, path_redir->fd); dbgln("redir path '{}' <-({})-> {}", path_redir->path, (int)path_redir->direction, path_redir->fd);
} else if (redir->is_fd_redirection()) { } else if (redir->is_fd_redirection()) {
auto* fdredir = (const AST::FdRedirection*)&redir; auto* fdredir = (const AST::FdRedirection*)redir.ptr();
dbgln("redir fd {} -> {}", fdredir->old_fd, fdredir->new_fd); dbgln("redir fd {} -> {}", fdredir->old_fd, fdredir->new_fd);
} else if (redir->is_close_redirection()) { } else if (redir->is_close_redirection()) {
auto close_redir = (const AST::CloseRedirection*)&redir; auto close_redir = (const AST::CloseRedirection*)redir.ptr();
dbgln("close fd {}", close_redir->fd); dbgln("close fd {}", close_redir->fd);
} else { } else {
VERIFY_NOT_REACHED(); VERIFY_NOT_REACHED();