Skip to content

Commit 2e0de6b

Browse files
committed
test_base: use shlex to handle cmd splitting
shlex appears to handle escape sequences nicely.
1 parent 792dcbd commit 2e0de6b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/test_base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import logging.config
44
import os
55
import re
6+
import shlex
67
import threading
78
from pathlib import Path
89
from subprocess import run
@@ -66,7 +67,7 @@ def assert_log_msgs(self):
6667

6768
def warnet(self, cmd):
6869
self.log.debug(f"Executing warnet command: {cmd}")
69-
command = ["warnet"] + cmd.split()
70+
command = ["warnet"] + shlex.split(cmd) # shlex handles escape sequences nicely
7071
proc = run(command, capture_output=True)
7172
if proc.stderr:
7273
raise Exception(proc.stderr.decode().strip())

0 commit comments

Comments
 (0)