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

build and copy cli binary in postinstall script #42

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/.crystal/
/.shards/
/dev/
/bin/

# Libraries don't need dependency lock
# Dependencies will be locked in application that uses them
Expand Down
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
all:

install: ../../bin/sentry

../../bin/sentry: bin/sentry ../../bin
cp bin/sentry ../../bin/

../../bin:
mkdir -p ../../bin

bin/sentry:
shards build --release sentry

.PHONY: all install bin/sentry
7 changes: 7 additions & 0 deletions shard.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: sentry
version: 0.3.1

scripts:
postinstall: make install

targets:
sentry:
main: src/sentry_cli.cr

authors:
- Sam Eaton <[email protected]>
crystal: 0.27.0
Expand Down
7 changes: 2 additions & 5 deletions src/sentry.cr
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,10 @@ module Sentry
file_changed = true if (app_process && !app_process.terminated?)
end
end
rescue ex : Errno
rescue ex : File::Error
# The underlining lib for reading directories will fail very rarely, crashing Sentry
# This catches that error and allows Sentry to carry on normally
# https://github.com/crystal-lang/crystal/blob/59788834554399f7fe838487a83eb466e55c6408/src/errno.cr#L37
unless ex.to_s == "readdir: Input/output error"
raise ex
end
# https://github.com/crystal-lang/crystal/blob/677422167cbcce0aeea49531896dbdcadd2762db/src/crystal/system/unix/dir.cr#L19
end

start_app() if (file_changed || app_process.nil?)
Expand Down