Skip to content

Keyboard interrupt not working on Windows #52

@pdc1

Description

@pdc1

Hello,

I have found that keyboard interrupt does not work on Windows (I haven't tested it on other platforms).

What I found is that concurrent.futures.wait() does not return on the keyboard interrupt, making it necessary to introduce a timeout so the system can process the exception.

In ffmpeg.py execute() I tried changing:

            done, pending = concurrent.futures.wait(futures, return_when=concurrent.futures.FIRST_EXCEPTION)
            self._executed = False

to:

            pending = futures
            try:
                while pending:
                    done, pending = concurrent.futures.wait(
                        futures,
                        timeout=1,
                        return_when=concurrent.futures.FIRST_EXCEPTION,
                    )
            except KeyboardInterrupt as e:
                self.terminate()
                executor.shutdown(wait=True, cancel_futures=True)
                raise e
            self._executed = False

With that change, keyboard interrupt works as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions