|
1 | 1 | #!/bin/bash |
2 | 2 |
|
3 | | -# unzip the app |
4 | | - |
| 3 | +# Unzip the app |
5 | 4 | ZIPFILE_PATH="$(pwd)/dist/OpenAdapt.app.zip" |
6 | 5 | unzip -o "$ZIPFILE_PATH" -d "$(pwd)/dist" |
7 | 6 |
|
8 | | -APP_PATH="$(pwd)/dist/OpenAdapt.app/Contents/MacOS/OpenAdapt.app" |
9 | | - |
10 | | -# print current directory |
| 7 | +# Current directory for reference |
11 | 8 | echo "Current directory: $(pwd)" |
12 | | -echo "App path: $APP_PATH" |
13 | | - |
14 | | -# Run the app |
15 | | -open "$APP_PATH" |
16 | 9 |
|
17 | | -# Allow some time for the application to launch |
18 | | -sleep 30 |
| 10 | +# Path to the app |
| 11 | +APP_PATH="$(pwd)/dist/OpenAdapt.app" |
| 12 | +EXECUTABLE_PATH="$APP_PATH/Contents/MacOS/OpenAdapt" |
| 13 | +echo "App path: $APP_PATH" |
| 14 | +echo "Executable path: $EXECUTABLE_PATH" |
19 | 15 |
|
20 | | -# Verify that the executable exists |
21 | | -if [ -z "$APP_PATH" ]; then |
22 | | - echo "Error: Could not find executable in $APP_PATH" |
| 16 | +# Verify app exists |
| 17 | +if [ ! -d "$APP_PATH" ]; then |
| 18 | + echo "Error: Could not find app at $APP_PATH" |
23 | 19 | exit 1 |
24 | 20 | fi |
25 | 21 |
|
26 | | -# Get the process IDs |
27 | | -PIDS=$(pgrep -f "$APP_PATH") |
28 | | - |
29 | | -# Verify that the process IDs were found |
30 | | -if [ -z "$PIDS" ]; then |
31 | | - echo "Error: Could not find process IDs for $APP_PATH" |
| 22 | +if [ ! -f "$EXECUTABLE_PATH" ]; then |
| 23 | + echo "Error: Could not find executable at $EXECUTABLE_PATH" |
32 | 24 | exit 1 |
33 | 25 | fi |
34 | 26 |
|
35 | | -# Variable to track if any process is still running |
36 | | -ALL_PROCESSES_RUNNING=true |
| 27 | +# Run the app |
| 28 | +open "$APP_PATH" |
37 | 29 |
|
38 | | -# Check if the processes are still running |
39 | | -for PID in $PIDS; do |
40 | | - if ! ps -p $PID > /dev/null; then |
41 | | - echo "Process $PID is not running" |
42 | | - ALL_PROCESSES_RUNNING=false |
43 | | - break |
44 | | - fi |
45 | | -done |
| 30 | +# Wait for app to start |
| 31 | +sleep 30 |
46 | 32 |
|
47 | | -# Set the exit code variable based on the processes' status |
48 | | -if [ "$ALL_PROCESSES_RUNNING" = true ]; then |
| 33 | +# Check for running process - try both the app name and binary name |
| 34 | +if pgrep -f "OpenAdapt" > /dev/null || pgrep -f "OpenAdapt.app" > /dev/null; then |
| 35 | + echo "Process is running" |
49 | 36 | EXIT_CODE=0 |
50 | 37 | else |
| 38 | + echo "Error: Could not find process IDs for OpenAdapt" |
51 | 39 | EXIT_CODE=1 |
52 | 40 | fi |
53 | 41 |
|
|
0 commit comments