Skip to content

fix(commit): use os.unlink to remove temp file #1396

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 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion commitizen/commands/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def manual_edit(self, message: str) -> str:
subprocess.call(argv)
with open(file_path) as temp_file:
message = temp_file.read().strip()
file.unlink()
os.unlink(file.name)
return message

def __call__(self):
Expand Down
2 changes: 0 additions & 2 deletions tests/commands/test_commit_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,6 @@ def test_manual_edit(editor, config, mocker: MockFixture, tmp_path):

assert edited_message == test_message.strip()

temp_file.unlink()


@skip_below_py_3_13
def test_commit_command_shows_description_when_use_help_option(
Expand Down