1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-19 00:58:56 +00:00

Add beginnings of platform detection

This commit is contained in:
Sameet Sapra 2018-02-25 11:03:06 -06:00
parent 38310cb5fe
commit f8d6993c91

View File

@ -1,7 +1,9 @@
import subprocess import subprocess
import urllib.request import urllib.request
import sys
import six import six
import psutil
from ..conf import settings from ..conf import settings
from ..logs import warn, debug from ..logs import warn, debug
@ -32,6 +34,7 @@ def print_alias(known_args):
def print_experimental_shell_history(): def print_experimental_shell_history():
filename_suffix = sys.platform
client_release = 'https://www.dropbox.com/s/m0jqp8i4c6woko5/client?dl=1' client_release = 'https://www.dropbox.com/s/m0jqp8i4c6woko5/client?dl=1'
filename = settings.env['__SHELL_LOGGER_BINARY_PATH'] filename = settings.env['__SHELL_LOGGER_BINARY_PATH']
debug('Downloading the shell_logger release and putting it in the path ... ') debug('Downloading the shell_logger release and putting it in the path ... ')
@ -43,5 +46,10 @@ def print_experimental_shell_history():
env={'__SHELL_LOGGER_BINARY_PATH': settings.env['__SHELL_LOGGER_BINARY_PATH']}) env={'__SHELL_LOGGER_BINARY_PATH': settings.env['__SHELL_LOGGER_BINARY_PATH']})
print(''.join([line.decode() for line in proc.stdout.readlines()])) print(''.join([line.decode() for line in proc.stdout.readlines()]))
# If process is running, close it
if filename in (p.name() for p in psutil.process_iter()):
subprocess.Popen(['./{0}'.format(filename), '-mode', 'daemon'])
subprocess.Popen(['rm', './{0}'.format(filename)])
subprocess.Popen(['./{0}'.format(filename), '-mode', 'daemon'], subprocess.Popen(['./{0}'.format(filename), '-mode', 'daemon'],
env={'__SHELL_LOGGER_SOCKET': settings.env['__SHELL_LOGGER_SOCKET']}) env={'__SHELL_LOGGER_SOCKET': settings.env['__SHELL_LOGGER_SOCKET']})