mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
parent
70eb7aa627
commit
7b15c85ff5
Notes:
sideshowbarker
2024-07-19 04:15:54 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/7b15c85ff5e Pull-request: https://github.com/SerenityOS/serenity/pull/2995 Issue: https://github.com/SerenityOS/serenity/issues/2989 Reviewed-by: https://github.com/awesomekling
3 changed files with 15 additions and 5 deletions
|
@ -267,7 +267,8 @@ int Shell::builtin_exit(int argc, const char** argv)
|
|||
}
|
||||
stop_all_jobs();
|
||||
save_history();
|
||||
printf("Good-bye!\n");
|
||||
if (m_is_interactive)
|
||||
printf("Good-bye!\n");
|
||||
exit(exit_code);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ extern char** environ;
|
|||
|
||||
void Shell::print_path(const String& path)
|
||||
{
|
||||
if (s_disable_hyperlinks) {
|
||||
if (s_disable_hyperlinks || !m_is_interactive) {
|
||||
printf("%s", path.characters());
|
||||
return;
|
||||
}
|
||||
|
@ -1092,9 +1092,17 @@ Shell::Shell()
|
|||
int rc = gethostname(hostname, Shell::HostNameSize);
|
||||
if (rc < 0)
|
||||
perror("gethostname");
|
||||
rc = ttyname_r(0, ttyname, Shell::TTYNameSize);
|
||||
if (rc < 0)
|
||||
perror("ttyname_r");
|
||||
|
||||
auto istty = isatty(STDIN_FILENO);
|
||||
m_is_interactive = istty;
|
||||
|
||||
if (istty) {
|
||||
rc = ttyname_r(0, ttyname, Shell::TTYNameSize);
|
||||
if (rc < 0)
|
||||
perror("ttyname_r");
|
||||
} else {
|
||||
ttyname[0] = 0;
|
||||
}
|
||||
|
||||
{
|
||||
auto* cwd = getcwd(nullptr, 0);
|
||||
|
|
|
@ -218,6 +218,7 @@ private:
|
|||
Vector<LocalFrame> m_local_frames;
|
||||
|
||||
HashMap<String, String> m_aliases;
|
||||
bool m_is_interactive { true };
|
||||
};
|
||||
|
||||
static constexpr bool is_word_character(char c)
|
||||
|
|
Loading…
Reference in a new issue