Add process-utils for testing process execution#17047
Open
straight-shoota wants to merge 18 commits into
Open
Conversation
59a940b to
bbcc99e
Compare
Sija
reviewed
Jun 6, 2026
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.
process_specneeds some example programs to test the behaviour ofProcess.runetc.Previously, it used several platform-specific commands and shell scripts to do that.
This patch introduces a portable implementation of helper programs in Crystal. They are compiled directly into the spec executable and can be called like
spec_binary pu cat(this happens implicitly viaProcess.executable_path).As a result, the same helper commands work across all platforms and the only requirement is the spec executable. The commands are much cleaner which makes it easier to understand the specs.
We can drop a lot of platform-specific details in the spec code.
I'm leaving
print_env_shell_commandfor now because it's used in ashell: truespec which probably needs a different refactor.ENVpropagation broken when spawining process withclear_env: trueon MSYS2 #17046. I'll probably skip that.crystal-pusubcommand?We've been discussed this idea for a long time, I was finally reminded of it by https://log.pfad.fr/2026/self-calling-executable/ and https://abhinavg.net/2022/05/15/hijack-testmain/