aspect-cli icon indicating copy to clipboard operation
aspect-cli copied to clipboard

Add support for interactive child processes

Open Silic0nS0ldier opened this issue 3 months ago • 3 comments

Adds status function to Command instances to allow running of child processes with stdin connected, such as a shell like bash. Unlike spawn this implicitly waits for the child process to exit.

The function's name status is borrowed from the Rust standard library.


Changes are visible to end-users: yes

  • Searched for relevant documentation and updated as needed: yes
  • Breaking change (forces users to change their own code or config): no
  • Suggested release notes appear below: yes Support for interactive child processes via ctx.std.process.command("APP_NAME").status().

Test plan

  • ~Covered by existing test cases~ New API surface.
  • ~New test cases added~ No test cases for spawn(), so nothing to build upon.
  • Manual testing; please provide instructions so we can reproduce:
    def _impl(ctx):
        shell = ctx.std.env.var("SHELL") or "sh"
        print("Running " + shell)
        cmd = ctx.std.process.command(shell)
        result = cmd.status()
        print(shell + " finished with exit code " + str(result.code))
    test_task = task(
       name = "test-task",
       implementation = _impl,
    )
    
    Then integrate the task with MODULE.aspect and run aspect test-task. When in the interactive shell use exit (or whatever applies to your shell) to resume the task.

Silic0nS0ldier avatar Nov 21 '25 01:11 Silic0nS0ldier

Motivation for this contribution is to allow porting of an edit patches workflow over to Aspect CLI.

An interactive shell (running in a temporary directory) is used to allow users a chance to edit and create new commits, on exit (provided there are no uncommitted changes) patches are generated from commits on top of the baseline (a branch, tag, or an initial generated commit when working on source archives).

Silic0nS0ldier avatar Nov 21 '25 01:11 Silic0nS0ldier

@thesayyn what's the next step here?

alexeagle avatar Dec 05 '25 21:12 alexeagle

i don't know why the CI is failing but probably not related. I don't have the powers to merge this without having a green CI.

thesayyn avatar Dec 06 '25 00:12 thesayyn

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Jan 23 '26 02:01 CLAassistant