mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:37:45 +00:00
Terminal: Use new format functions.
This commit is contained in:
parent
0dec600a2a
commit
712e348fad
1 changed files with 5 additions and 6 deletions
|
@ -67,9 +67,8 @@ static void utmp_update(const char* tty, pid_t pid, bool create)
|
||||||
}
|
}
|
||||||
if (utmpupdate_pid)
|
if (utmpupdate_pid)
|
||||||
return;
|
return;
|
||||||
char shell_pid_string[64];
|
const auto shell_pid_string = String::formatted("{}", pid);
|
||||||
snprintf(shell_pid_string, sizeof(shell_pid_string), "%d", pid);
|
execl("/bin/utmpupdate", "/bin/utmpupdate", "-f", "Terminal", "-p", shell_pid_string.characters(), (create ? "-c" : "-d"), tty, nullptr);
|
||||||
execl("/bin/utmpupdate", "/bin/utmpupdate", "-f", "Terminal", "-p", shell_pid_string, (create ? "-c" : "-d"), tty, nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static pid_t run_command(int ptm_fd, String command)
|
static pid_t run_command(int ptm_fd, String command)
|
||||||
|
@ -77,7 +76,7 @@ static pid_t run_command(int ptm_fd, String command)
|
||||||
pid_t pid = fork();
|
pid_t pid = fork();
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
perror("fork");
|
perror("fork");
|
||||||
dbg() << "run_command: could not fork to run '" << command << "'";
|
dbgln("run_command: could not fork to run '{}'", command);
|
||||||
return pid;
|
return pid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,7 +316,7 @@ int main(int argc, char** argv)
|
||||||
}));
|
}));
|
||||||
app_menu.add_separator();
|
app_menu.add_separator();
|
||||||
app_menu.add_action(GUI::CommonActions::make_quit_action([](auto&) {
|
app_menu.add_action(GUI::CommonActions::make_quit_action([](auto&) {
|
||||||
dbgprintf("Terminal: Quit menu activated!\n");
|
dbgln("Terminal: Quit menu activated!");
|
||||||
GUI::Application::the()->quit();
|
GUI::Application::the()->quit();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -382,7 +381,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
config->sync();
|
config->sync();
|
||||||
int result = app->exec();
|
int result = app->exec();
|
||||||
dbg() << "Exiting terminal, updating utmp";
|
dbgln("Exiting terminal, updating utmp");
|
||||||
utmp_update(pts_name, 0, false);
|
utmp_update(pts_name, 0, false);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue