Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add exec/2: posix_spawn #3133

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Commits on Jun 25, 2024

  1. Add exec/2: posix_spawn

    This is an initial MVP with quite a few things still missing (such as:
    better error messages, documentation, tests).
    Despite this, it is already feature-complete on POSIX platforms (on
    Windows it currently reports an "unsupported on this platform" error).
    
    The signature is `anything | exec(path; [args…])`.
    `path` and all `args` must be strings.
    `anything` will be converted to a string if it isn't a string in memory,
    then piped into the process' stdin.
    The output is all stdout of the process.
    The exit code is not reported.
    
    Technically, "path" can be a simple name and `$PATH` will be searched.
    This is because the underlying function is `posix_spawnp`.
    This can bec hanged easily.
    
    The process does not have access to environment variables.
    This can be changed as well.
    
    Piping between programs works. Here's an example to try it out:
    `tostring | exec("seq"; [.]) | exec("wc"; "-l")`
    Expected output when inputting numbers is that number,
    but it notably goes through seq, then line-counting.
    CosmicToast committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    ce84ba7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a4c197a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    0a3848a View commit details
    Browse the repository at this point in the history
  4. Add tests for exec/2

    CosmicToast committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    648e772 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    7d8c020 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    000f24f View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    5d3f3cd View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    a359afe View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    51a620c View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    cabd52d View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    17a2198 View commit details
    Browse the repository at this point in the history