mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-31 10:11:14 +00:00
Merge pull request #332 from mcarton/331
#331 Fix bug with empty commands
This commit is contained in:
commit
0ad70a1edc
@ -35,6 +35,8 @@ class TestGetCommand(object):
|
||||
env={})
|
||||
|
||||
@pytest.mark.parametrize('args, result', [
|
||||
(['thefuck', ''], None),
|
||||
(['thefuck', '', ''], None),
|
||||
(['thefuck', 'ls', '-la'], 'ls -la'),
|
||||
(['thefuck', 'ls'], 'ls')])
|
||||
def test_get_command_script(self, args, result):
|
||||
|
@ -27,7 +27,7 @@ def setup_user_dir():
|
||||
|
||||
def wait_output(settings, popen):
|
||||
"""Returns `True` if we can get output of the command in the
|
||||
`wait_command` time.
|
||||
`settings.wait_command` time.
|
||||
|
||||
Command will be killed if it wasn't finished in the time.
|
||||
|
||||
@ -50,6 +50,7 @@ def get_command(settings, args):
|
||||
else:
|
||||
script = ' '.join(args[1:])
|
||||
|
||||
script = script.strip()
|
||||
if not script:
|
||||
return
|
||||
|
||||
@ -91,6 +92,11 @@ def fix_command():
|
||||
logs.debug(u'Run with settings: {}'.format(pformat(settings)), settings)
|
||||
|
||||
command = get_command(settings, sys.argv)
|
||||
|
||||
if not command:
|
||||
logs.debug('Empty command, nothing to do', settings)
|
||||
return
|
||||
|
||||
corrected_commands = get_corrected_commands(command, user_dir, settings)
|
||||
selected_command = select_command(corrected_commands, settings)
|
||||
if selected_command:
|
||||
|
Loading…
x
Reference in New Issue
Block a user