Skip to content

What should run_process do if it's cancelled but it can't kill the child process? #1209

@dj-foxxy

Description

@dj-foxxy

The async context manager tries to SIGKILL the subprocess, which causes a PermissionError if that subprocess is sudo

import trio


async def main():
    with trio.move_on_after(1):
        await trio.run_process(['sleep', '2'])
    print('Cancelled 1')

    with trio.move_on_after(1):
        await trio.run_process(['sudo', 'sleep', '2'])
    print('Cancelled 2')


trio.run(main)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions