Skip to content

Commit

Permalink
fix(CLI): check if device is booted before recording
Browse files Browse the repository at this point in the history
fix #1
  • Loading branch information
fjcaetano committed Sep 27, 2019
1 parent fe36eb5 commit e670550
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion bin/ios-simulator-gif
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,23 @@
##############
main() {
parse_args "$@"
check_booted
record
convert_gif
}

#####################
### Check Booted ###
#####################
check_booted() {
xcrun simctl list | grep Booted &> /dev/null

if [[ $? -ne 0 ]]; then
echo "No devices are booted"
exit 404
fi
}

##################
### Record ###
##################
Expand Down Expand Up @@ -89,7 +102,7 @@ parse_args() {
#########################
display_help() {
CMD=$(basename -- $0)

echo "Usage: $CMD [options] {out_file} {-- [ffmpeg options]}" >&2
echo
echo " out_file The output file name (default: simulator.gif)"
Expand Down

0 comments on commit e670550

Please sign in to comment.