{
  "id": 6674395,
  "title": "Freeze returncode, Streams, and TimeoutExpired Before One Wrapper Extract",
  "url": "https://urgent.news/2026/09/11/freeze-returncode-streams-and-timeoutexpired-before-one-wrapper",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-11T00:20:57.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/hackrs_6393/freeze-returncode-streams-and-timeoutexpired-before-one-wrapper-extract-36a1"
  },
  "original_language": "en",
  "account": "In order to extract a command wrapper without a result snapshot, it is crucial to freeze returncode, streams, and TimeoutExpired before making any changes. This is because callers depend on exit codes and stream types together, as well as TimeoutExpired instead of CalledProcessError. A rewrite that simplifies subprocess.run will break these callers.\n\nThe purpose of the extract is to record specific fields for every fixture command, such as argv or shell string, returncode, stdout type (bytes or str), stderr type (bytes or str), exception class name (or null), timeout value in seconds (or null), flag, encoding name, and the wrapper's actual read keys. Path is intentionally omitted in this harness for now. The goal is to freeze process results and exception names only.\n\nTo achieve this, the source material proposes the following steps:\n\n1. Isolate one wrapper by picking a function that still calls subprocess.run and copying its signature into characterization tests. Do not modify production code in this initial step.\n2. Write a recorder that calls the live wrapper and persists JSON files next to the characterization tests. Commit these JSON records before proceeding with any helper extract.\n\nThe JSON record should include:\n- returncode as an integer (including zero)\n- stdout type (bytes or str)\n- stderr type (bytes or str)\n- exception class name or null\n- timeout value in seconds or null\n- flag text\n- encoding name\n- wrapper's actual read keys\n\nIt is important to note that cwd should not be recorded in this particular setup, as path drift is a different failure class.",
  "summary": "Extracting a command wrapper without a result snapshot breaks callers. Characterization tests must freeze returncode, streams, and timeout first. The smallest safe change starts after that freeze. Callers depend on exit codes and stream types together. They also depend on TimeoutExpired instead of CalledProcessError. A rewrite that simplifies subprocess.run will break those callers. Why success…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}