Permalink
Browse files

Fixed #22234 -- Replaced OS-specific code with subprocess.call() in d…

…bshell.

This fixes escaping of special characters on Windows.
  • Loading branch information...
Mihail Milushev authored and timgraham committed Mar 9, 2014
1 parent e4dd8b5 commit bf5382c6e549d78da9f7029cd86686459b52eaed
@@ -1,5 +1,4 @@
-import os
-import sys
+import subprocess
from django.db.backends import BaseDatabaseClient
@@ -34,7 +33,4 @@ def runshell(self):
if db:
args += [db]
- if os.name == 'nt':
- sys.exit(os.system(" ".join(args)))
- else:
- os.execvp(self.executable_name, args)
+ subprocess.call(args)
@@ -1,5 +1,4 @@
-import os
-import sys
+import subprocess
from django.db.backends import BaseDatabaseClient
@@ -10,7 +9,4 @@ class DatabaseClient(BaseDatabaseClient):
def runshell(self):
conn_string = self.connection._connect_string()
args = [self.executable_name, "-L", conn_string]
- if os.name == 'nt':
- sys.exit(os.system(" ".join(args)))
- else:
- os.execvp(self.executable_name, args)
+ subprocess.call(args)
@@ -1,5 +1,4 @@
-import os
-import sys
+import subprocess
from django.db.backends import BaseDatabaseClient
@@ -17,7 +16,4 @@ def runshell(self):
if settings_dict['PORT']:
args.extend(["-p", str(settings_dict['PORT'])])
args += [settings_dict['NAME']]
- if os.name == 'nt':
- sys.exit(os.system(" ".join(args)))
- else:
- os.execvp(self.executable_name, args)
+ subprocess.call(args)
@@ -1,5 +1,4 @@
-import os
-import sys
+import subprocess
from django.db.backends import BaseDatabaseClient
@@ -10,7 +9,4 @@ class DatabaseClient(BaseDatabaseClient):
def runshell(self):
args = [self.executable_name,
self.connection.settings_dict['NAME']]
- if os.name == 'nt':
- sys.exit(os.system(" ".join(args)))
- else:
- os.execvp(self.executable_name, args)
+ subprocess.call(args)

0 comments on commit bf5382c

Please sign in to comment.