awslabs / aws-shell

An integrated shell for working with the AWS CLI.
Apache License 2.0
7.15k stars 770 forks source link

.edit on Linux without setting VISUAL/EDITOR crashes the shell #88

Closed ztane closed 8 years ago

ztane commented 8 years ago

... because it assumes that vim exists:

Traceback (most recent call last):
  File "/usr/local/bin/aws-shell", line 9, in <module>
    load_entry_point('aws-shell==0.0.1', 'console_scripts', 'aws-shell')()
  File "/usr/local/lib/python3.4/dist-packages/awsshell/__init__.py", line 63, in main
    shell.run()
  File "/usr/local/lib/python3.4/dist-packages/awsshell/app.py", line 213, in run
    self._dot_cmd.handle_cmd(text, application=self)
  File "/usr/local/lib/python3.4/dist-packages/awsshell/app.py", line 113, in handle_cmd
    self.HANDLER_CLASSES[cmd_name]().run(parts, application)
  File "/usr/local/lib/python3.4/dist-packages/awsshell/app.py", line 82, in run
    p = self._popen_cls([editor, f.name])
  File "/usr/lib/python3.4/subprocess.py", line 859, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.4/subprocess.py", line 1459, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'vim'
jamesls commented 8 years ago

Couple actionable things I see:

  1. The error message should be cleaned up. No stack trace should be printed either.

2a. Change the default to vi. This is what other tools fall back to (including git and from what I understand is a part of the posix standard (http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap02.html)

2b. Try several editors, similar to what's done here.

I think I'd prefer to go with 2a instead of 2b for now unless we start hearing that vi is not available on people's machines.

donnemartin commented 8 years ago

I think I'd prefer to go with 2a instead of 2b for now unless we start hearing that vi is not available on people's machines.

Sounds good :+1: