Debian Codegraph @

run_bundled_example.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. sh
2 set -e
3
4 BOLD_GREEN="\033[1;35m"
5 RESET="\033[0m"
6
7 statusscip-shell shell shell-project 0.0.0 status().() {
8 label="$1"
9 shift
10 printfscip-shell system . . printf. "%b%12s%b %s\n" "$BOLD_GREEN" "$label" "$RESET" "$*"
11 }
12
13 EXAMPLE="${1:-un_async}"
14 APP=target/debug/examples/bundle/osx/notify-rust.app
15
16 statusscip-shell shell shell-project 0.0.0 status(). "Bundling" "$EXAMPLE (example)"
17 cargoscip-shell system . . cargo. bundle --example "$EXAMPLE" --features preview-macos-un
18
19 statusscip-shell shell shell-project 0.0.0 status(). "Signing" "$APP (ad-hoc)"
20 codesign --force --deep --sign - "$APP"
21
22 statusscip-shell shell shell-project 0.0.0 status(). "Opening" "$APP"
23 pkillscip-shell system . . pkill. -x "$EXAMPLE" 2>/dev/nullscip-shell filesystem . . `/dev/null`. || truescip-shell system . . true.
24 open "$APP"
25
26 # Give the app a moment to launch, then grab its PID.
27 sleepscip-shell system . . sleep. 0.5
28 APP_PID=$(pgrepscip-shell system . . pgrep. -x "$EXAMPLE" | headscip-shell system . . head. -1)
29
30 statusscip-shell shell shell-project 0.0.0 status(). "Streaming" "logs for process: $EXAMPLE (PID $APP_PID — stops when app exits)"
31 # First replay any logs already emitted since the app launched, then stream live.
32 # Both commands include debug level messages.
33 PREDICATE="process == \"$EXAMPLE\" AND subsystem == \"notify-rust\""
34 # Uncomment the line below to also include Apple's internal UserNotifications/XPC logs:
35 # PREDICATE="process == \"$EXAMPLE\""
36 log show \
37 --predicate "$PREDICATE" \
38 --style compact \
39 --debug \
40 --info \
41 --last 2s
42 log stream \
43 --predicate "$PREDICATE" \
44 --style compact \
45 --level debug &
46 LOG_PID=$!
47
48 # Wait for the app to exit, then stop the log stream.
49 while killscip-shell system . . kill. -0 "$APP_PID" 2>/dev/nullscip-shell filesystem . . `/dev/null`.; do
50 sleepscip-shell system . . sleep. 0.5
51 done
52 statusscip-shell shell shell-project 0.0.0 status(). "Done" "$EXAMPLE exited — stopping log stream"
53 killscip-shell system . . kill. "$LOG_PID" 2>/dev/nullscip-shell filesystem . . `/dev/null`. || truescip-shell system . . true.