fix: improve native runner removal process by handling missing plist files
This commit is contained in:
@@ -494,12 +494,19 @@ remove_native_runner() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if launchctl list 2>/dev/null | grep -q "com.gitea.runner.${RUNNER_NAME}"; then
|
if launchctl list 2>/dev/null | grep -q "com.gitea.runner.${RUNNER_NAME}"; then
|
||||||
|
if [[ -n "$plist_path" ]]; then
|
||||||
if $needs_sudo; then
|
if $needs_sudo; then
|
||||||
sudo launchctl unload "$plist_path" 2>/dev/null || true
|
sudo launchctl unload "$plist_path" 2>/dev/null || true
|
||||||
else
|
else
|
||||||
launchctl unload "${plist_path:-$HOME/Library/LaunchAgents/${plist_name}}" 2>/dev/null || true
|
launchctl unload "$plist_path" 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
log_success "Launchd service unloaded"
|
log_success "Launchd service unloaded"
|
||||||
|
else
|
||||||
|
# Plist file is gone but launchctl still shows the service — force-remove by label.
|
||||||
|
launchctl remove "com.gitea.runner.${RUNNER_NAME}" 2>/dev/null || \
|
||||||
|
sudo launchctl remove "com.gitea.runner.${RUNNER_NAME}" 2>/dev/null || true
|
||||||
|
log_warn "Plist not found on disk — removed service by label"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "$plist_path" ]] && [[ -f "$plist_path" ]]; then
|
if [[ -n "$plist_path" ]] && [[ -f "$plist_path" ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user