Skip to content

Preserve subprocess_create failure error details#96

Merged
sheredom merged 2 commits into
mainfrom
fix/issue-50-create-error-detail
May 24, 2026
Merged

Preserve subprocess_create failure error details#96
sheredom merged 2 commits into
mainfrom
fix/issue-50-create-error-detail

Conversation

@sheredom
Copy link
Copy Markdown
Owner

@sheredom sheredom commented May 24, 2026

Fixes #50.

This keeps subprocess_create* success behavior unchanged (0 means success), and gives non-zero returns a documented portable meaning via the new enum subprocess_error_e:

  • subprocess_error_not_found
  • subprocess_error_permission_denied
  • subprocess_error_no_memory
  • subprocess_error_invalid_options
  • subprocess_error_invalid_environment
  • subprocess_error_pipe
  • subprocess_error_spawn
  • subprocess_error_unknown

It also preserves the platform-specific failure detail so callers can report richer diagnostics:

  • POSIX: errno is restored after cleanup.
  • Windows: GetLastError() is restored after cleanup.

Added docs and a regression test for a missing executable returning subprocess_error_not_found while preserving ENOENT / ERROR_FILE_NOT_FOUND.

Local verification:

git diff --check
cmake --build build
(cd build && ./subprocess_test && ./subprocess_mt_test)

Both test binaries pass locally: 48/48 each.


🧙 Conjured by AI via pi.dev using gpt-5.5

🧙 Conjured by AI via [pi.dev](https://pi.dev/) using gpt-5.5
🧙 Conjured by AI via [pi.dev](https://pi.dev/) using gpt-5.5
@sheredom sheredom merged commit 945f5ad into main May 24, 2026
24 checks passed
@sheredom sheredom deleted the fix/issue-50-create-error-detail branch May 24, 2026 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Verboser output of child in case of invalid/unknown command

1 participant