lucc / khard

Console vcard client
https://khard.readthedocs.io/en/latest/
GNU General Public License v3.0
600 stars 65 forks source link

Spaces in $EDITOR should separate arguments #293

Closed falsifian closed 2 years ago

falsifian commented 3 years ago

I have EDITOR=emacsclient -t, which confuses khard:

falsifian angel-dfly ~ $ echo $EDITOR
emacsclient -t
falsifian angel-dfly ~ $ khard new
Traceback (most recent call last):
  File "/usr/local/bin/khard", line 11, in <module>
    load_entry_point('khard==0.17.0', 'console_scripts', 'khard')()
  File "/usr/local/lib/python3.7/site-packages/khard/khard.py", line 1137, in main
    args.open_editor)
  File "/usr/local/lib/python3.7/site-packages/khard/khard.py", line 544, in new_subcommand
    create_new_contact(selected_address_book)
  File "/usr/local/lib/python3.7/site-packages/khard/khard.py", line 109, in create_new_contact
    edit(temp_file_name)
  File "/usr/local/lib/python3.7/site-packages/khard/khard.py", line 95, in edit
    child = subprocess.Popen(editor)
  File "/usr/local/lib/python3.7/subprocess.py", line 800, in __init__
    restore_signals, start_new_session)
  File "/usr/local/lib/python3.7/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'emacsclient -t': 'emacsclient -t'

Other programs seem to handle this. I suggest splitting $EDITOR on spaces.

lucc commented 2 years ago

As a workaround you can specify the editor in your config file. The format allows you to specify a list so the question of splitting on whitespace is avoided.

For $EDITOR I am unclear what "The Standard" is. I assume there is no proper defined standard and every program just does what they think is right. Or is there some UNIX/Linux (quasi) "standard" that is documented somewhere?

falsifian commented 2 years ago

Thanks for the response. I was able to work around it. I'm not aware of any standard, but I think khard is the first place I noticed any trouble, which makes me suspect splitting on spaces is common.

(Anyway, I've switched editors and my current editing command doesn't need any extra arguments.)