Skip to content

feat(process): implement asynchronous process execution module#19

Merged
Vaishnav-Sabari-Girish merged 1 commit into
mainfrom
feat/process
May 2, 2026
Merged

feat(process): implement asynchronous process execution module#19
Vaishnav-Sabari-Girish merged 1 commit into
mainfrom
feat/process

Conversation

@Vaishnav-Sabari-Girish
Copy link
Copy Markdown
Contributor

Introduces the ns_process module to allow non-blocking, background process execution. This enables the C main thread to safely orchestrate concurrent tasks (like downloading data and running media players) without freezing.

Key additions:

  • Implemented ns_process_spawn to launch background processes via sh -c.
  • Implemented ns_process_is_running for non-blocking status polling.
  • Implemented ns_process_kill to forcefully terminate active child processes.
  • Implemented ns_process_free to safely clean up heap handles and prevent zombie processes.
  • Enforced strict FFI safety by marking raw pointer dereferences as unsafe and adhering to Clippy standards.

Fixes & Examples:

  • fix(cmd): Updated ns_cmd error mappings to strictly use NsError::Any to comply with the updated ns_error enum.
  • test: Added 16_process.c demonstrating background execution and early termination.
  • test: Added 17_concurrent_process.c demonstrating non-blocking multi-process orchestration (curl + mpv).

Introduces the `ns_process` module to allow non-blocking, background
process execution. This enables the C main thread to safely orchestrate
concurrent tasks (like downloading data and running media players)
without freezing.

Key additions:
- Implemented `ns_process_spawn` to launch background processes via `sh -c`.
- Implemented `ns_process_is_running` for non-blocking status polling.
- Implemented `ns_process_kill` to forcefully terminate active child processes.
- Implemented `ns_process_free` to safely clean up heap handles and prevent zombie processes.
- Enforced strict FFI safety by marking raw pointer dereferences as `unsafe` and adhering to Clippy standards.

Fixes & Examples:
- fix(cmd): Updated `ns_cmd` error mappings to strictly use `NsError::Any` to comply with the updated `ns_error` enum.
- test: Added `16_process.c` demonstrating background execution and early termination.
- test: Added `17_concurrent.c` demonstrating non-blocking multi-process orchestration (curl + mpv).

Signed-off-by: Vaishnav Sabari Girish <vaishnav.sabari.girish@gmail.com>
@Vaishnav-Sabari-Girish Vaishnav-Sabari-Girish merged commit f92ac41 into main May 2, 2026
5 checks passed
@Vaishnav-Sabari-Girish Vaishnav-Sabari-Girish deleted the feat/process branch May 2, 2026 17:26
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.

1 participant