Skip to content

Plugin could cause the interpreter to get "stuck" in changed working directory #13

@zyzzyxdonta

Description

@zyzzyxdonta

The call function of this plugin changes the working directory of the program:

chdir(command.args.path)

If one of the following function calls fails, the call method could be exited via an exception, causing the interpreter to get stuck in the changed directory. To mitigate this, the chdir function from contextlib could be used. Something like:

from contextlib import chdir

def __call_(...):
    with chdir(...):
        data = self.read_from_toml(...)

    return data, {...}

Since this is only available since Python 3.11, unfortunately this problem can't be fixed immediately (without re-implementing the context manager). But constructing the file path based on the working directory parameter might be an option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions