Repository navigation
Conversation
A string server: command runs via "sh -c". On systems where /bin/sh is dash the shell forks the command rather than exec-ing it, so killing the shell left the actual server running, orphaned - holding its port and keeping any pipe on its stdout open. Servers now run in their own process group, which is killed as a whole when shot-scraper multi or video finishes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VL4haavg5i8JXVFFrPU8p3
_start_server() passes start_new_session to Popen and the new _stop_server() kills the process group. Tests that fake server processes now mock _stop_server(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VL4haavg5i8JXVFFrPU8p3
If --no-clobber or --output rule out every shot, shot-scraper multi now exits before starting any server: processes or launching the browser. This makes "multi shots.yml -n" a cheap way to create just the missing screenshots, even when the file defines a server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VL4haavg5i8JXVFFrPU8p3
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VL4haavg5i8JXVFFrPU8p3
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two fixes for
server:handling, found while setting upshot-scraper multi shots.yml --no-clobberto generate Datasette's documentation screenshots.Kill the whole server process group on cleanup
A string
server:command runs viash -c. On Linux, where/bin/shis usually dash, the shell forks the command instead of exec-ing it. Killing the shell therefore left the real server running as an orphan: it held its port and kept any pipe on its stdout open. With a Datasette server,just shots | tailhung until the server was killed by hand. The existing test suite also leftpython -m http.server 9023andslow_server.pyrunning after every run._start_server()now passesstart_new_session=Trueon POSIX, so each server gets its own process group._stop_server()kills that whole group withos.killpg(..., SIGKILL). On Windows it still callsprocess.kill()._cleanup_servers()uses_stop_server(), so bothmultiandvideoare covered._stop_server().test_multi_server_string_child_process_is_stoppedfails before the fix.multidoes nothing when every step is ruled outBefore this change,
multi --no-clobberstarted everyserver:step and launched the browser before checking whether any shot was missing. When every output already existed, the run started a server, launched Chromium and immediately killed both.Now, if
--no-clobberor--outputrule out everysh:,python:andurl:step,multireturns before starting any servers or Playwright. The checks inside the loop are unchanged; they have moved into a_skipped_by_options()helper. In a local test, a run with nothing to do dropped from about 0.7s to about 0.25s, which is just Python imports.test_multi_nothing_to_do_skips_server_and_browser, parametrized for-nand-o, fails before the fix.test_multi_no_clobber_starts_server_for_missing_shotchecks that a remaining shot still starts the server.docs/multi.mddocuments the new behavior and fixes the "aleady" typo.One edge-case change: a YAML file with no
sh:,python:orurl:steps at all, such as one with onlyserver:items, now exits without starting anything.Testing
uv run pytest: 167 passed. Nohttp.serverorslow_server.pyprocesses are left running afterwards.cog --check docs/*.mdpasses.The branch history adds a
Popensubclass in one commit and replaces it with the functions above in the next, so a squash merge gives a cleaner history.🤖 Generated with Claude Code
https://claude.ai/code/session_01VL4haavg5i8JXVFFrPU8p3
Generated by Claude Code
📚 Documentation preview 📚: https://shot-scraper--211.org.readthedocs.build/en/211/