diff --git a/README.md b/README.md index 9b11d89..d353db1 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,9 @@ runcoder ~/code/my-project far. **Press q there (or Ctrl+C, or close the window) and it deletes the server**, then prints what the session cost. q works from the deploy on, also while the model downloads (not during the setup and session questions before it). While the session runs, r reopens Qwen Code where - you left off. + you left off. **On Windows, press q or Ctrl+C rather than closing the window**: Windows ends a + closed console's programs about 10 seconds later, which can be before the delete is done. If + you closed it anyway, run `runcoder down`. If the folder has earlier Qwen Code sessions, runcoder asks whether to continue the latest (c), pick one (p), or start fresh (Enter). `-c`, `-p` and `-n` answer that in advance. @@ -68,7 +70,7 @@ Other commands: Something that bills by the second must never be left running. runcoder deletes the server when: -- you press q, press Ctrl+C, or close its window; +- you press q, press Ctrl+C, or close its window (on Windows, see the note under "Use" above); - Qwen Code has been closed for 15 minutes (`RUNCODER_QWEN_IDLE_MINUTES`); - the session reaches 150 minutes (`RUNCODER_MAX_MINUTES`); - the model is lost and does not come back after three tries; diff --git a/src/session.mjs b/src/session.mjs index b6352f6..028dbe1 100644 --- a/src/session.mjs +++ b/src/session.mjs @@ -39,8 +39,9 @@ async function lock() { other = JSON.parse(readFileSync(paths.lock, "utf8")); } catch {} // Only the runcoder that wrote the lock counts: a process ID reused since has another command - // line. If the command line could not be read then, any live process with that ID counts. - if (other.pid && alive(other.pid) && (!other.command || (await commandOf(other.pid)) === other.command)) { + // line. If the command line could not be read, then or now, any live process with that ID counts. + const now = other.pid && alive(other.pid) ? await commandOf(other.pid) : null; + if (now !== null && (!other.command || !now || now === other.command)) { die(`runcoder is already running (process ${other.pid}). Use that window, or run: runcoder down`); } rmSync(paths.lock, { recursive: true, force: true });