25 lines
780 B
Bash
Executable File
25 lines
780 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# args_json: {"type":"object","required":["pid"],"properties":{"pid":{"type":"string","description":"Process PID"}}}
|
|
# ollie:prompt
|
|
# ## process_dismiss
|
|
#
|
|
# Dismiss a finished detached process, removing it from the list.
|
|
#
|
|
# ```
|
|
# process_dismiss(pid="12345")
|
|
# ```
|
|
# ollie:end
|
|
|
|
set -euo pipefail
|
|
|
|
source "$(dirname "$0")/_lib/args.sh"
|
|
|
|
pid=$(arg_require "pid")
|
|
session="${OLLIE_SESSION_ID:?OLLIE_SESSION_ID not set}"
|
|
|
|
dbus-send --session --dest=org.ollie.SessionManager --type=method_call --print-reply \
|
|
/org/ollie/SessionManager org.ollie.SessionManager.DismissDetached \
|
|
"string:$session" "int32:$pid" 2>&1 | grep -q 'boolean true' && \
|
|
echo "Dismissed PID $pid" || \
|
|
{ echo "Failed to dismiss PID $pid (still running or not found)" >&2; exit 1; }
|