Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: beep on Ubuntu (backport: 4-0-x) #16357

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 8 additions & 5 deletions atom/common/platform_util_linux.cc
Expand Up @@ -139,11 +139,14 @@ bool MoveItemToTrash(const base::FilePath& full_path) {

void Beep() {
// echo '\a' > /dev/console
FILE* console = fopen("/dev/console", "r");
if (console == NULL)
return;
fprintf(console, "\a");
fclose(console);
FILE* fp = fopen("/dev/console", "a");
if (fp == nullptr) {
fp = fopen("/dev/tty", "a");
}
if (fp != nullptr) {
fprintf(fp, "\a");
fclose(fp);
}
}

} // namespace platform_util