[server] fix db-dump with sqlite
authorJulien Cristau <julien.cristau@logilab.fr>
Tue, 03 Nov 2015 15:55:35 +0100
changeset 10824 fbefdaa56d2b
parent 10823 48f59820ff78
child 10825 56ca5f6e0533
[server] fix db-dump with sqlite 'gzip -c dbname > backupfile' needs to go through the shell.
server/sqlutils.py
--- a/server/sqlutils.py	Tue Nov 03 15:54:46 2015 +0100
+++ b/server/sqlutils.py	Tue Nov 03 15:55:35 2015 +0100
@@ -47,8 +47,12 @@
 SQL_PREFIX = 'cw_'
 
 def _run_command(cmd):
-    print(' '.join(cmd))
-    return subprocess.call(cmd)
+    if isinstance(cmd, string_types):
+        print(cmd)
+        return subprocess.call(cmd, shell=True)
+    else:
+        print(' '.join(cmd))
+        return subprocess.call(cmd)
 
 
 def sqlexec(sqlstmts, cursor_or_execute, withpb=True,