Asztali folyamatok életciklusa
Kezeli az alkalmazás saját folyamatait és ablakváltásait idegen programok leállítása vagy shellfüggőség nélkül.
desktop-process-lifecycle
Ezt a skillt használó csapattagok
Mikor hasznos?
Akkor használd, ha kilépés után gyermekfolyamat marad vagy grafikus indítás nem talál eszközt.
Miben segít neked?
- Nyilvántartja az elindított folyamatokat, csak a saját folyamatfát állítja le.
- Kifejezetten oldja fel a programútvonalat, shellbe helyettesítés nélkül ad argumentumot.
- Kezeli az egypéldányos működést, ablakéletciklust és alvás utáni visszatérést.
Például ezt kérheted
Javítsd a kilépést túlélő saját helyi szervert, a felhasználó külön indított szerverének megtartásával. Indítsd el mindkét szervert, lépj ki, majd vizsgáld a folyamatgazdát. Csak az alkalmazás saját fája álljon le, az újranyitás ne használjon elavult állapotot.
Részletes dokumentáció
Itt a skill eredeti útmutatóját, példáit és ellenőrzési szempontjait olvashatod az eredeti nyelven.
Összecsukás
Process & Application Lifecycle
Desktop applications must manage their entire process tree reliably across cold start, window close/reopen, OS sleep/wake, crashes, and application quit—without leaving orphaned servers, locked SQLite databases, or zombie CLI processes behind.
Child Process & Ownership Discipline
- Track only the processes your app spawned:
- Record the
ChildProcesshandle andpid(plus process group / Job Object) of every embedded server, worker, or CLI task launched by the application. - Never run blanket
killall nodeortaskkill /IM node.exe, which destroys the user's unrelated development servers or IDE processes!
- Record the
- Clean Cross-Platform Process Tree Termination:
- On macOS/Linux: spawn long-running tool/worker trees in their own process group or send
SIGTERMto the child and its descendants, wait a bounded drain window (e.g., 3s–5s) for in-flight SQLite transactions or state checkpoints to flush, and escalate toSIGKILLonly if still alive. - On Windows:
child.kill()terminates only the immediate process, leaving grand-child processes alive. Use Windows Job Objects (JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE) ortaskkill /PID <pid> /T /Fon timeout so the entire process tree exits when the desktop app closes or crashes.
- On macOS/Linux: spawn long-running tool/worker trees in their own process group or send
- Never interpolate shell strings:
- Spawn processes with
execFile/spawn(binaryPath, argsArray, { shell: false, windowsHide: true })so file paths containing spaces, quotes, or Unicode characters (C:\Users\Gábor Laczkovszki\My Project) never break or inject shell commands.
- Spawn processes with
GUI Environment & PATH Resolution on macOS / Windows
When a user launches a macOS .app from Finder/Dock/Spotlight, the process inherits launchd's minimal PATH (/usr/bin:/bin:/usr/sbin:/sbin)—not their interactive shell PATH where Homebrew (/opt/homebrew/bin), nvm, fnm, volta, pyenv, or ~/.local/bin live:
- Resolve the user's login shell environment once at startup (e.g., invoking
$SHELL -ilc 'env -0'with a short timeout on macOS/Linux and augmenting well-known tool paths like/opt/homebrew/bin,/usr/local/bin,~/.local/bin) so external CLIs (git,claude,codex) are found reliably.
Window Lifecycle, Single-Instance Lock & Sleep/Wake
- Single-instance coordination: Acquire a single-instance lock (
app.requestSingleInstanceLock()in Electron ortauri-plugin-single-instance) before initializing the database or local server. When a second instance is launched (e.g., via deep link or file association), forward the URL/argv to the primary instance, focus its window, and exit the second instance immediately. - Explicit Window Close vs. App Quit:
- On macOS, closing the last window (
window-all-closed) conventionally keeps the app active in the Dock (activatere-opens the window), whereasCmd+Q(before-quit) initiates full shutdown. - Before quitting or applying an update while a task is running, either flush/checkpoint gracefully or prompt the user if an unrecoverable operation is in flight.
- On macOS, closing the last window (
Csomagban lévő fájlok 1
SKILL.md
