From 2ef74ded7999148b93cb29ec09ee189d86211ab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Mand=C3=A1k?= Date: Tue, 29 Sep 2015 12:47:32 +0200 Subject: [PATCH] Replace regular 'split' to 'shlex.split'. --- i3pystatus/core/command.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/i3pystatus/core/command.py b/i3pystatus/core/command.py index af79ce0..57915ba 100644 --- a/i3pystatus/core/command.py +++ b/i3pystatus/core/command.py @@ -1,6 +1,7 @@ import logging -from collections import namedtuple +import shlex import subprocess +from collections import namedtuple CommandResult = namedtuple("Result", ['rc', 'out', 'err']) @@ -25,7 +26,7 @@ def run_through_shell(command, enable_shell=False): """ if not enable_shell and not isinstance(command, list): - command = command.split() + command = shlex.split(command) returncode = None stderr = None @@ -67,7 +68,7 @@ def execute(command, detach=False): command = ["i3-msg", "exec", command] else: if not isinstance(command, list): - command = command.split() + command = shlex.split(command) try: subprocess.Popen(command, stdin=subprocess.DEVNULL,