Skip to content
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

cz commit -e crashes on editor exit #1352

Open
naimmas opened this issue Feb 7, 2025 · 0 comments
Open

cz commit -e crashes on editor exit #1352

naimmas opened this issue Feb 7, 2025 · 0 comments

Comments

@naimmas
Copy link

naimmas commented Feb 7, 2025

Description

I want to add multi-line description so first I initialize my commit message header and then added the description using vim editor, but on write and quite :wq I received the following error

cz commit -e
? Select the type of change you are committing feat: A new feature. Correlates with MINOR in SemVer
? What is the scope of this change? (class or file name): (press [enter] to skip)
 HW timer
? Write a short and imperative summary of the code changes: (lower case and no period)
 feat and fixes
? Provide additional contextual information about the code changes: (press [enter] to skip)
 
? Is this a BREAKING CHANGE? Correlates with MAJOR in SemVer No
? Footer. Information about Breaking Changes and reference issues that this commit closes: (press [enter] to skip)
 
Traceback (most recent call last):
  File "/usr/local/bin/cz", line 8, in <module>
    sys.exit(main())
             ~~~~^^
  File "/usr/local/Cellar/commitizen/4.1.1/libexec/lib/python3.13/site-packages/commitizen/cli.py", line 651, in main
    args.func(conf, arguments)()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/Cellar/commitizen/4.1.1/libexec/lib/python3.13/site-packages/commitizen/commands/commit.py", line 130, in __call__
    m = self.manual_edit(m)
  File "/usr/local/Cellar/commitizen/4.1.1/libexec/lib/python3.13/site-packages/commitizen/commands/commit.py", line 92, in manual_edit
    file.unlink()
    ^^^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.13.2/Frameworks/Python.framework/Versions/3.13/lib/python3.13/tempfile.py", line 494, in __getattr__
    a = getattr(file, name)
AttributeError: '_io.TextIOWrapper' object has no attribute 'unlink'

Steps to reproduce

make sure that the vim editor is the default editor in bash

cz commit -e
edit the message
exit insert mode
write & quite :wq

Current behavior

The following error thrown on editor exit and commit message not saved in .git/COMMIT_EDITMSG

Traceback (most recent call last):
  File "/usr/local/bin/cz", line 8, in <module>
    sys.exit(main())
             ~~~~^^
  File "/usr/local/Cellar/commitizen/4.1.1/libexec/lib/python3.13/site-packages/commitizen/cli.py", line 651, in main
    args.func(conf, arguments)()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/Cellar/commitizen/4.1.1/libexec/lib/python3.13/site-packages/commitizen/commands/commit.py", line 130, in __call__
    m = self.manual_edit(m)
  File "/usr/local/Cellar/commitizen/4.1.1/libexec/lib/python3.13/site-packages/commitizen/commands/commit.py", line 92, in manual_edit
    file.unlink()
    ^^^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.13.2/Frameworks/Python.framework/Versions/3.13/lib/python3.13/tempfile.py", line 494, in __getattr__
    a = getattr(file, name)
AttributeError: '_io.TextIOWrapper' object has no attribute 'unlink'

Desired behavior

committing the updated message

Screenshots

Image

Environment

OS: macOS Sequoia Version 15.3 (24D60)
Vim version 9.1.754

> cz version --report
Commitizen Version: 4.1.1
Python Version: 3.13.2 (main, Feb  4 2025, 14:51:09) [Clang 16.0.0 (clang-1600.0.26.6)]
Operating System: Darwin 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant