Skip to content

Modernize process management with async I/O and cross-platform improvements - #3

Merged
mikecovlee merged 31 commits into
masterfrom
modernization
Jun 29, 2026
Merged

Modernize process management with async I/O and cross-platform improvements#3
mikecovlee merged 31 commits into
masterfrom
modernization

Conversation

@mikecovlee

@mikecovleemikecovlee commented Jun 17, 2026

Copy link
Copy Markdown
Member

This pull request introduces comprehensive improvements to the build system, CI pipeline, and project documentation for the CovScript process extension. The main enhancements include integrating libuv as a static dependency, adding platform-aware CI workflows for both CovScript release and nightly channels, and providing detailed project guidance for contributors and AI assistants. These changes collectively ensure robust cross-platform compatibility, consistent SDK/ABI handling, and clearer contribution practices.

Build system and dependency integration:

  • Integrated libuv as a static library via a new submodule (third_party/libuv), updated CMakeLists.txt to build and link it, and addressed GCC 14 compatibility issues on MinGW. [1][2]
  • Refactored source file lists and target properties in CMakeLists.txt for platform-specific builds and improved handling of include/link directories and compiler definitions.

Continuous Integration (CI):

  • Added a cross-platform GitHub Actions workflow (.github/workflows/ci.yml) that builds and tests the extension on Linux, macOS, and Windows (MinGW-w64), against both CovScript release and nightly channels. The workflow also builds CovScript from source and runs both script and C++ unit tests.

Documentation and contributor guidance:

  • Added .github/copilot-instructions.md and CLAUDE.md to provide project-specific constraints and instructions for AI assistants and contributors, covering module naming, build/test practices, SDK/ABI compatibility, and API design principles. [1][2]

Testing enhancements:

  • Introduced an optional C++ unit test target (test_uv_fs) in CMakeLists.txt to exercise UV wrapper code paths not reachable from scripts, and integrated its execution into the CI workflow. [1][2]

- Implemented process management functions for Windows in `process_win32_wait.cpp`, including wait, terminate, check exit status, and send signals.
- Added various test scripts to validate process execution, asynchronous file handling, and output redirection.
- Created unit tests for process functionalities, ensuring robust error handling and expected behavior across different scenarios.
- Included tests for both Linux and Windows environments to ensure cross-platform compatibility.
@mikecovlee

Copy link
Copy Markdown
MemberAuthor

@copilot 请修复 CI 失败的问题

@covscriptcovscript deleted a comment from CopilotAIJun 17, 2026
@mikecovleemikecovlee changed the title Add Windows process management support and comprehensive testsRewrite with uv backendJun 18, 2026
…sors
- Introduced `test_fiber.csc` to validate process operations within fibers, including wait, communicate, and kill functionalities.
- Added `test_stream.csc` to test file stream accessors, ensuring compatibility with standard library iostream behavior.
- Updated `test_unit.csc` to enhance process wait and exit code checks, including timeout semantics and stream accessors.
- Improved exception handling and validation checks across all tests to ensure robustness and reliability.
- Updated the `file` class in `file.hpp` to improve readability and maintainability by restructuring comments and code formatting.
- Removed unnecessary forwarding headers for `stream` and `string`.
- Enhanced the `async_work` structure in `process.hpp` for better clarity and organization.
- Improved error handling and code structure in `process_unix.cpp` and `process_win32.cpp`, including better management of command-line arguments and environment variables.
- Refined the polling mechanism for child processes in `process_unix_wait.cpp` to utilize `std::optional` for clearer exit status handling.
- General code cleanup and formatting adjustments across multiple files to adhere to coding standards.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR rewrites the covscript-process extension around a unified libuv-backed async backend, updates the build system to build libuv as a static dependency, and refreshes the public CNI/C++ API docs plus CI/test coverage to match the new behavior.

Changes:

  • Integrates libuv (as a git submodule + static build) and updates platform process creation/waiting logic to support async waits, better quoting (Windows), and kill-tree semantics.
  • Adds a new file_t abstraction with async file I/O (process.async.fstream, file_t.read/write/flush, stream accessors) and expands the CNI API surface (wait_poll, wait_with, communicate, etc.).
  • Adds comprehensive CovScript test suites and a cross-platform GitHub Actions CI workflow running them on Linux/macOS/Windows.

Reviewed changes

Copilot reviewed 38 out of 39 changed files in this pull request and generated 7 comments.

Show a summary per file
FileDescription
CMakeLists.txtBuilds libuv from third_party/libuv and links it into the extension; modernizes target setup/includes.
process.cppMajor CNI rewrite: adds fiber-aware waits, process.async loop control, and async file_t methods via libuv.
src/process.cppAdjusts cross-platform process pipe/redirect setup to support inherited stdio and merge semantics.
src/process_win32.cppReworks Windows process creation: handle inheritance, env block build, MSVCRT-correct quoting.
src/process_win32_wait.cppImplements Windows wait/kill/kill-tree and reliable has_exited() check.
src/process_unix.cppReworks Unix fork/exec and FD cleanup strategy; adds process group setup for kill-tree.
src/process_unix_wait.cppAdds Unix wait/timeout/has_exited/kill-tree implementations using waitid + nanosleep polling.
src/core.cppLicense header refresh + formatting changes.
include/mozart++/mpp_system/file.hppAdds mpp::file wrapper + open_file() factory for async I/O + redirects.
include/mozart++/fileNew forwarding header to mpp_system/file.hpp.
include/mozart++/mpp_foundation/io.hppFormatting and small refactors for fd utilities/pipes.
include/mozart++/mpp_foundation/fdstream.hppImproves write robustness (chunking) and formatting updates.
include/mozart++/mpp_core/*Formatting/refactor updates (type traits, function parsing, exceptions, event emitter).
README.mdNew project overview, build/test instructions, and API usage notes.
CNI_API.md / CXX_API.mdFull API documentation rewrite for the new surfaces/semantics.
tests/test*.cscAdds/updates regression tests covering process waits/communicate, fibers, async fs, redirects, streams.
.github/workflows/ci.ymlNew cross-platform CI building CovScript + extension and running all test suites.
.github/copilot-instructions.md / CLAUDE.mdContributor/AI assistant guidance and project constraints.
.gitmodulesAdds libuv submodule definition.
.gitignoreAdds ignores for build outputs and temp artifacts used by tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadprocess.cpp Outdated
Comment threadsrc/process_win32.cpp
Comment threadsrc/process_win32.cpp
Comment threadsrc/process_unix.cpp Outdated
Comment threadinclude/mozart++/mpp_system/file.hpp
Comment threadinclude/mozart++/mpp_system/file.hpp
Comment threadCNI_API.md

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 38 out of 39 changed files in this pull request and generated 6 comments.

Comment threadsrc/process_win32.cpp
Comment threadsrc/process_win32.cpp
Comment threadsrc/process_win32.cpp
Comment threadsrc/process_unix.cpp
Comment threadsrc/process_unix_wait.cpp
Comment threadsrc/process_unix_wait.cpp
…escriptor handling and environment variable parsing

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 38 out of 39 changed files in this pull request and generated 3 comments.

Comment threadprocess.cpp
Comment threadprocess.cpp
Comment threadCNI_API.md
…ous file system wrapper, covering scenarios such as no deadline, zero deadline, and large file writes.
…asize backward compatibility and supplement the implementation layer description.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 39 out of 40 changed files in this pull request and generated 3 comments.

Comment threadprocess.cpp Outdated
Comment threadprocess.cpp
Comment threadprocess.cpp Outdated

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 39 out of 40 changed files in this pull request and generated 1 comment.

Comment threadprocess.cpp

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 39 out of 40 changed files in this pull request and generated 4 comments.

Comment threadinclude/mozart++/mpp_foundation/io.hpp Outdated
Comment threadinclude/mozart++/mpp_foundation/io.hpp Outdated
Comment threadinclude/mozart++/mpp_foundation/fdstream.hpp
Comment threadsrc/process_win32.cpp Outdated

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 41 out of 42 changed files in this pull request and generated 2 comments.

Comment threadsrc/process_win32.cpp
Comment threadREADME.md Outdated
…d error handling to CI scripts, and updated the README to include git submodule initialization instructions.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 41 out of 42 changed files in this pull request and generated 3 comments.

Comment threadprocess.cpp
Comment on lines +28 to +32
#include <uv.h>

#include <chrono>
#include <thread>

Comment threadinclude/mozart++/mpp_core/function.hpp
Comment threadinclude/mozart++/mpp_core/function.hpp
@mikecovleemikecovlee changed the title Rewrite with uv backendModernize process management with async I/O and cross-platform improvementsJun 29, 2026
@mikecovlee
mikecovlee merged commit efbdfde into masterJun 29, 2026
6 checks passed
@mikecovlee
mikecovlee deleted the modernization branch June 29, 2026 08:59
Sign up for freeto 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.

2 participants

@mikecovlee