Skip to content

Cancelling built-ins #1185

Description

@evanrittenhouse

Feature description

Hi there! I'm currently using brush at $DAYJOB. One of the use cases that we need to support is remote timeout registration. I currently have this mostly working for external commands as we can just killpg the entire process group.

Use case / motivation

I'd like to cancel the running commands without killing the server process. That means that I can't use typical PID/PGID-level kill signals

Proposed solution

Currently, the best approach I have is to check for pending signals in applicable Execute::execute calls (or equivalently, check that a deadline has elapsed). That can be Rust-ified with a wrapper method or something as well. Spawning everything in subprocesses won't work as we have to preserve environment changes in the parent shell.

Additional context

In general, I'm wondering if there's been any thought put into how to best propagate cancellation through Brush (e.g. shell built-ins, spawned subprocess, commands running in Tokio tasks, etc.). I definitely could be missing something as I'm pretty new to shells in general. I'm happy to raise a PR to upstream this once I'm done as well, if that'd be helpful!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions