fix: improve native runner removal process by handling missing plist files
This commit is contained in:
@@ -494,12 +494,19 @@ remove_native_runner() {
|
||||
fi
|
||||
|
||||
if launchctl list 2>/dev/null | grep -q "com.gitea.runner.${RUNNER_NAME}"; then
|
||||
if [[ -n "$plist_path" ]]; then
|
||||
if $needs_sudo; then
|
||||
sudo launchctl unload "$plist_path" 2>/dev/null || true
|
||||
else
|
||||
launchctl unload "${plist_path:-$HOME/Library/LaunchAgents/${plist_name}}" 2>/dev/null || true
|
||||
launchctl unload "$plist_path" 2>/dev/null || true
|
||||
fi
|
||||
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
|
||||
|
||||
if [[ -n "$plist_path" ]] && [[ -f "$plist_path" ]]; then
|
||||
|
||||
Reference in New Issue
Block a user