Replace regular 'split' to 'shlex.split'.
This commit is contained in:
parent
68d11b2f81
commit
2ef74ded79
@ -1,6 +1,7 @@
|
|||||||
import logging
|
import logging
|
||||||
from collections import namedtuple
|
import shlex
|
||||||
import subprocess
|
import subprocess
|
||||||
|
from collections import namedtuple
|
||||||
|
|
||||||
CommandResult = namedtuple("Result", ['rc', 'out', 'err'])
|
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):
|
if not enable_shell and not isinstance(command, list):
|
||||||
command = command.split()
|
command = shlex.split(command)
|
||||||
|
|
||||||
returncode = None
|
returncode = None
|
||||||
stderr = None
|
stderr = None
|
||||||
@ -67,7 +68,7 @@ def execute(command, detach=False):
|
|||||||
command = ["i3-msg", "exec", command]
|
command = ["i3-msg", "exec", command]
|
||||||
else:
|
else:
|
||||||
if not isinstance(command, list):
|
if not isinstance(command, list):
|
||||||
command = command.split()
|
command = shlex.split(command)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
subprocess.Popen(command, stdin=subprocess.DEVNULL,
|
subprocess.Popen(command, stdin=subprocess.DEVNULL,
|
||||||
|
Loading…
Reference in New Issue
Block a user