Skip to content

Added code-runner.stopWait command #1222

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

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

Conversation

Chrysaloid
Copy link

I find it annoying having to close windows produced by Python's matplotlib.pyplot before running the code again.

So I created this keyboard shortcut:

    {
        "key": "f5",
        "command": "runCommands",
        "args": {
            "commands": [
                "code-runner.stop",
                "code-runner.run",
            ]
        },
    },

But the run commands was being executed too soon - before previous process fully closed - so the new process could not be registered correctly. The result was that new processes (matplotlib windows) would spawn every time I pressed F5.

So I created stopWait command that waits for the process to emit "close" event after it receives the kill signal.

It is a drop-in replacement for the stop command in the shortcut:

    {
        "key": "f5",
        "command": "runCommands",
        "args": {
            "commands": [
                "code-runner.stopWait",
                "code-runner.run",
            ]
        },
    },

I'm using Python as an example here but this should work for any programming language that waits for anything when run (i.e. user input, network request).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant