feat(process): add ProcessJsonDecodeError and remove run_sync/pipe_sync#108
Open
bedus-creation wants to merge 3 commits into
Open
feat(process): add ProcessJsonDecodeError and remove run_sync/pipe_sync#108bedus-creation wants to merge 3 commits into
bedus-creation wants to merge 3 commits into
Conversation
- Add ProcessJsonDecodeError(ValueError) to exception.py with stdout and original attributes - Update output_json() in ProcessResult to raise ProcessJsonDecodeError on invalid JSON instead of bare json.JSONDecodeError - Remove run_sync() and pipe_sync() from PendingProcess and Process facade (async-only API) - Remove Sync API mentions from Process class docstring - Delete TestPendingProcessRunSync and TestProcessRunSync test classes - Add TestProcessResultJson with 4 tests covering dict/list parsing and error behaviour - Update test_result.py to expect ProcessJsonDecodeError instead of json.JSONDecodeError Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace the blocking subprocess.run() call in PendingProcess.run() tty branch with asyncio.create_subprocess_shell() passing stdin/stdout/stderr as None so the child inherits the parent's real TTY. Timeout is honoured via asyncio.wait_for(); ProcessTimedOutException is raised on expiry. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
ProcessJsonDecodeError— newValueErrorsubclass inexception.pywithstdoutandoriginalattributes, providing a rich error message that includes the raw outputoutput_json()— now raisesProcessJsonDecodeError(wrapping the originaljson.JSONDecodeError) instead of lettingjson.JSONDecodeErrorpropagate nakedrun_sync()/pipe_sync()from bothPendingProcessand theProcessfacade — the process module is async-first; sync helpers are removed to reduce surface areaTestPendingProcessRunSyncandTestProcessRunSync; addTestProcessResultJson(4 tests); updatetest_result.pyto expect the new exception typeTest plan
uv run pytest tests/process/ -v)TestProcessResultJson::test_output_json_returns_dict— valid JSON dict round-trips correctlyTestProcessResultJson::test_output_json_returns_list— valid JSON list round-trips correctlyTestProcessResultJson::test_output_json_raises_on_invalid_json—ProcessJsonDecodeErrorraised on bad inputTestProcessResultJson::test_output_json_error_contains_raw_output— exception message includes the raw stdout🤖 Generated with Claude Code