test-signed-lifecycle.sh bash
40 lines 1.1 KB
Raw
sha256:bd1eb24434d281fe65142038c1bf217493421f5a86880c22dff7e6037d2d4700 feat(companion): add production macOS distribution path Human minor ⚠ breaking 24 days ago
1 #!/bin/bash
2 set -euo pipefail
3
4 app="/Applications/Knowtation.app"
5 runtime_pattern='/Applications/Knowtation.app/Contents/Resources/runtime/node/bin/node .*/companion/runtime/main.mjs --mode app'
6 [[ -d "$app" ]] || { echo "installed signed app is required" >&2; exit 2; }
7
8 wait_for_runtime() {
9 local attempt
10 for attempt in {1..40}; do
11 if pgrep -f "$runtime_pattern" >/dev/null; then return 0; fi
12 sleep 0.25
13 done
14 echo "app runtime did not start" >&2
15 return 1
16 }
17
18 wait_for_stop() {
19 local attempt
20 for attempt in {1..40}; do
21 if ! pgrep -f "$runtime_pattern" >/dev/null; then return 0; fi
22 sleep 0.25
23 done
24 echo "app runtime did not stop with its parent" >&2
25 return 1
26 }
27
28 open -a "$app"
29 wait_for_runtime
30 /usr/local/bin/knowtation companion status
31 launchctl print "gui/$UID/store.knowtation.companion.custody" >/dev/null
32
33 osascript -e 'tell application id "store.knowtation.companion" to quit'
34 wait_for_stop
35
36 open -a "$app"
37 wait_for_runtime
38 /usr/local/bin/knowtation companion status
39
40 echo "signed lifecycle start, custody registration, parent shutdown, and restart passed"
File History 1 commit
sha256:bd1eb24434d281fe65142038c1bf217493421f5a86880c22dff7e6037d2d4700 feat(companion): add production macOS distribution path Human minor ⚠ 24 days ago