feat(process): implement asynchronous process execution module#19
Merged
Conversation
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>
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.
Introduces the
ns_processmodule 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:
ns_process_spawnto launch background processes viash -c.ns_process_is_runningfor non-blocking status polling.ns_process_killto forcefully terminate active child processes.ns_process_freeto safely clean up heap handles and prevent zombie processes.unsafeand adhering to Clippy standards.Fixes & Examples:
ns_cmderror mappings to strictly useNsError::Anyto comply with the updatedns_errorenum.16_process.cdemonstrating background execution and early termination.17_concurrent_process.cdemonstrating non-blocking multi-process orchestration (curl + mpv).