mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-10-30 22:54:14 +00:00 
			
		
		
		
	#869: Use fish --version instead of an interactive shell for info()
				
					
				
			This prevents initialisation and consequentially a recursive loop. Fix #869 Ref oh-my-fish/plugin-thefuck#11
This commit is contained in:
		
				
					committed by
					
						 Pablo Aguiar
						Pablo Aguiar
					
				
			
			
				
	
			
			
			
						parent
						
							ac343fb1bd
						
					
				
				
					commit
					ce5feaebf7
				
			| @@ -114,5 +114,6 @@ class TestFish(object): | |||||||
|         assert not shell.how_to_configure().can_configure_automatically |         assert not shell.how_to_configure().can_configure_automatically | ||||||
|  |  | ||||||
|     def test_info(self, shell, Popen): |     def test_info(self, shell, Popen): | ||||||
|         Popen.return_value.stdout.read.side_effect = [b'3.5.9'] |         Popen.return_value.stdout.read.side_effect = [b'fish, version 3.5.9\n'] | ||||||
|         assert shell.info() == 'Fish Shell 3.5.9' |         assert shell.info() == 'Fish Shell 3.5.9' | ||||||
|  |         assert Popen.call_args[0][0] == ['fish', '--version'] | ||||||
|   | |||||||
| @@ -105,9 +105,9 @@ class Fish(Generic): | |||||||
|  |  | ||||||
|     def info(self): |     def info(self): | ||||||
|         """Returns the name and version of the current shell""" |         """Returns the name and version of the current shell""" | ||||||
|         proc = Popen(['fish', '-c', 'echo $FISH_VERSION'], |         proc = Popen(['fish', '--version'], | ||||||
|                      stdout=PIPE, stderr=DEVNULL) |                      stdout=PIPE, stderr=DEVNULL) | ||||||
|         version = proc.stdout.read().decode('utf-8').strip() |         version = proc.stdout.read().decode('utf-8').split()[-1] | ||||||
|         return u'Fish Shell {}'.format(version) |         return u'Fish Shell {}'.format(version) | ||||||
|  |  | ||||||
|     def put_to_history(self, command): |     def put_to_history(self, command): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user