Skip to content

Commit c92105d

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

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

src/sentry.cr

Lines changed: 10 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)
@@ -191,6 +198,7 @@ module Sentry
191198
app_process.signal(:kill)
192199
app_process.wait
193200
end
201+
`#{@sound_player} #{__DIR__}/sounds/drip.wav` unless @sound_player.blank?
194202
end
195203

196204
stdout "🤖 starting #{display_name}..."
@@ -217,6 +225,8 @@ module Sentry
217225
elsif !@app_built # if build fails on first time compiling, then exit
218226
stdout "🤖 Compile time errors detected. SentryBot shutting down..."
219227
exit 1
228+
else
229+
`#{@sound_player} #{__DIR__}/sounds/error.wav` unless @sound_player.blank?
220230
end
221231
end
222232

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)