fine-grain & brute force qemu kill (kill_qemus and kill_all_qemus)
[tests.git] / system / utils.py
index fab6844..4468b20 100644 (file)
@@ -36,3 +36,15 @@ def check_ping (hostname):
     command="ping -c 1 %s 1 %s"%(ping_timeout_option,hostname)
     (status,output) = commands.getstatusoutput(command)
     return status == 0
+
+# inserts a backslash before each occurence of the following chars
+# \ " ' < > & | ; ( ) $ * ~ 
+def backslash_shell_specials (command):
+    result=''
+    for char in command:
+        if char in "\\\"'<>&|;()$*~":
+            result +='\\'+char
+        else:
+            result +=char
+    return result
+