From e670550cf831df7676a72d0a02155fb9ced8b65c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vio=20Caetano?= Date: Fri, 27 Sep 2019 15:27:32 -0300 Subject: [PATCH] fix(CLI): check if device is booted before recording fix #1 --- bin/ios-simulator-gif | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/bin/ios-simulator-gif b/bin/ios-simulator-gif index 6dc07d9..ccd3002 100755 --- a/bin/ios-simulator-gif +++ b/bin/ios-simulator-gif @@ -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 ### ################## @@ -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)"