subprocess-socket-tests

Poll child PID listening ports for subprocess TCP server readiness and teardown.

1|Updated Feb 15, 2026
One-click install
npx skills add https://github.com/mlinnen/mr-pumpkin --skill subprocess-socket-tests
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: subprocess-socket-tests
Source: https://github.com/mlinnen/mr-pumpkin/tree/main/.squad/skills/subprocess-socket-tests
Command: npx skills add https://github.com/mlinnen/mr-pumpkin --skill subprocess-socket-tests

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Use this skill when tests spawn pumpkin_face.py or another TCP server in a subprocess and need deterministic readiness/cleanup across repeated runs.

Core Features & Use Cases

  • Treat process-owned listening state as readiness: poll the child PID's listening ports instead of assuming "some process is listening" means the spawned server is ready.
  • For command sockets that often return no payload, use a readiness teardown pattern where you ensure the server sees EOF and the client doesn't wait on a timeout.
  • Centralize teardown in a helper (stop_server) so every test path terminates the spawned process the same way.
  • Avoid readiness probes that consume the only pending TCP slot on a single-threaded server; if you must probe connectivity, do it after ownership is established or widen the server backlog.

Anti-Patterns

  • Polling localhost:5000 until it opens without checking which PID owns the port.
  • Duplicating ad hoc terminate()/wait()/kill() blocks in every test.
  • Expecting no-response commands to complete quickly while keeping the write side of the socket open.

Quick Start

Run a deterministic test by spawning the server in a subprocess and verify readiness via the child process's listening ports.

Frequently Asked Questions about subprocess-socket-tests

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I check if a subprocess TCP server is ready for testing?

Check subprocess TCP server readiness by polling the child PID's specific listening ports rather than assuming any process on localhost means the spawned server is ready. This verifies the exact process owns the port before tests proceed.

Why does my TCP server test hang on teardown after spawning a subprocess?

TCP server test teardown hangs when the write side of the socket stays open during no-response commands. Ensure the server sees EOF and centralize cleanup in a stop_server helper so every test path terminates the spawned process identically.

What is process-owned listening state in subprocess TCP testing?

Process-owned listening state is a readiness pattern that verifies the spawned child PID actually owns the listening TCP port, preventing false positives from other processes that might be bound to the same port during test runs.

What causes single-threaded TCP server readiness probes to fail?

Single-threaded TCP server readiness probes fail when the probe consumes the only pending TCP slot in the backlog. Establish ownership first or widen the server backlog before probing connectivity to avoid blocking the actual test client.

What are common anti-patterns for subprocess TCP server test cleanup?

Common subprocess TCP server test cleanup anti-patterns include polling localhost without checking PID ownership, duplicating ad hoc terminate, wait, and kill blocks in every test, and keeping the socket write side open during no-response commands.