Fixed #22234 -- Replaced OS-specific code with subprocess.call() in dbshell.
This fixes escaping of special characters on Windows.
This commit is contained in:
parent
e4dd8b5dde
commit
bf5382c6e5
|
@ -1,5 +1,4 @@
|
||||||
import os
|
import subprocess
|
||||||
import sys
|
|
||||||
|
|
||||||
from django.db.backends import BaseDatabaseClient
|
from django.db.backends import BaseDatabaseClient
|
||||||
|
|
||||||
|
@ -34,7 +33,4 @@ class DatabaseClient(BaseDatabaseClient):
|
||||||
if db:
|
if db:
|
||||||
args += [db]
|
args += [db]
|
||||||
|
|
||||||
if os.name == 'nt':
|
subprocess.call(args)
|
||||||
sys.exit(os.system(" ".join(args)))
|
|
||||||
else:
|
|
||||||
os.execvp(self.executable_name, args)
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import os
|
import subprocess
|
||||||
import sys
|
|
||||||
|
|
||||||
from django.db.backends import BaseDatabaseClient
|
from django.db.backends import BaseDatabaseClient
|
||||||
|
|
||||||
|
@ -10,7 +9,4 @@ class DatabaseClient(BaseDatabaseClient):
|
||||||
def runshell(self):
|
def runshell(self):
|
||||||
conn_string = self.connection._connect_string()
|
conn_string = self.connection._connect_string()
|
||||||
args = [self.executable_name, "-L", conn_string]
|
args = [self.executable_name, "-L", conn_string]
|
||||||
if os.name == 'nt':
|
subprocess.call(args)
|
||||||
sys.exit(os.system(" ".join(args)))
|
|
||||||
else:
|
|
||||||
os.execvp(self.executable_name, args)
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import os
|
import subprocess
|
||||||
import sys
|
|
||||||
|
|
||||||
from django.db.backends import BaseDatabaseClient
|
from django.db.backends import BaseDatabaseClient
|
||||||
|
|
||||||
|
@ -17,7 +16,4 @@ class DatabaseClient(BaseDatabaseClient):
|
||||||
if settings_dict['PORT']:
|
if settings_dict['PORT']:
|
||||||
args.extend(["-p", str(settings_dict['PORT'])])
|
args.extend(["-p", str(settings_dict['PORT'])])
|
||||||
args += [settings_dict['NAME']]
|
args += [settings_dict['NAME']]
|
||||||
if os.name == 'nt':
|
subprocess.call(args)
|
||||||
sys.exit(os.system(" ".join(args)))
|
|
||||||
else:
|
|
||||||
os.execvp(self.executable_name, args)
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import os
|
import subprocess
|
||||||
import sys
|
|
||||||
|
|
||||||
from django.db.backends import BaseDatabaseClient
|
from django.db.backends import BaseDatabaseClient
|
||||||
|
|
||||||
|
@ -10,7 +9,4 @@ class DatabaseClient(BaseDatabaseClient):
|
||||||
def runshell(self):
|
def runshell(self):
|
||||||
args = [self.executable_name,
|
args = [self.executable_name,
|
||||||
self.connection.settings_dict['NAME']]
|
self.connection.settings_dict['NAME']]
|
||||||
if os.name == 'nt':
|
subprocess.call(args)
|
||||||
sys.exit(os.system(" ".join(args)))
|
|
||||||
else:
|
|
||||||
os.execvp(self.executable_name, args)
|
|
||||||
|
|
Loading…
Reference in New Issue