Skip to content

Commit 752a31b

Browse files
committed
Add sound support for linux/macOS when build success or failed.
1 parent a994dc8 commit 752a31b

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

src/sentry.cr

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ module Sentry
145145
property display_name : String
146146
property should_build = true
147147
property files = [] of String
148+
@sound_player : String = ""
148149

149150
def initialize(
150151
@display_name : String,
@@ -163,6 +164,12 @@ module Sentry
163164
@app_built = false
164165
@should_install_shards = install_shards
165166
@colorize = colorize
167+
168+
{% if flag?(:linux) %}
169+
@sound_player = `which aplay 2>/dev/null`.chomp
170+
{% elsif flag(:darwin) %}
171+
@sound_player = `which afplay 2>/dev/null`.chomp
172+
{% end %}
166173
end
167174

168175
private def stdout(str : String)
@@ -214,9 +221,13 @@ module Sentry
214221
if build_result && build_result.success?
215222
@app_built = true
216223
create_app_process()
224+
`#{@sound_player} #{__DIR__}/sounds/drip.wav 2>/dev/null` unless @sound_player.blank?
217225
elsif !@app_built # if build fails on first time compiling, then exit
218226
stdout "🤖 Compile time errors detected. SentryBot shutting down..."
227+
`#{@sound_player} #{__DIR__}/sounds/error.wav 2>/dev/null` unless @sound_player.blank?
219228
exit 1
229+
else
230+
`#{@sound_player} #{__DIR__}/sounds/error.wav 2>/dev/null` unless @sound_player.blank?
220231
end
221232
end
222233

src/sounds/drip.wav

27.6 KB
Binary file not shown.

src/sounds/error.wav

43.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)