25 lines
855 B
Bash
Executable File
25 lines
855 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# ollie:prompt
|
|
# ## process_dismiss
|
|
#
|
|
# Dismiss a finished detached process, removing it from the list.
|
|
#
|
|
# **Args**: `[pid]`
|
|
#
|
|
# ```
|
|
# call_tool: calls=[{tool: "process_dismiss", args: ["12345"]}]
|
|
# ```
|
|
# ollie:end
|
|
|
|
set -euo pipefail
|
|
|
|
if [ $# -lt 1 ]; then echo '{"schema": {"type": "array", "items": [{"name": "pid", "type": "string", "description": "Process PID", "required": true}], "examples": [["12345"]]}}'; exit 1; fi
|
|
pid="${1}"
|
|
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; }
|