https://kotlinlang.org logo
Title
g

Geert

11/07/2021, 2:26 PM
Is it possible to let kotlin (ktor) make a beeping sound on the terminal output? On MacOs I could just print:
say "hello"
but when I print this with kotlin it is not working, I also tried
afplay /System/Library/Sounds/Ping.aiff
which is working in terminal, but not when using println or logger.info()
c

crummy

11/07/2021, 6:56 PM
println() just prints characters to the screen. Probably you want to run an actual command: https://www.baeldung.com/run-shell-command-in-java
g

Geert

11/07/2021, 10:29 PM
Thanks! Fixed it with
Runtime.getRuntime().exec()
p

Paul Griffith

11/08/2021, 2:38 AM
Depending on your terminal & environment, writing a
BEL
to stdout will sometimes trigger an audible beep: https://en.wikipedia.org/wiki/Bell_character