diff options
| author | Mihail Milushev <lanzz@lanzz.org> | 2014-03-09 13:00:42 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-08-04 09:21:03 -0400 |
| commit | bf5382c6e549d78da9f7029cd86686459b52eaed (patch) | |
| tree | 7be7807ea05b2444ef99dc2251e62ebcdddff778 | |
| parent | e4dd8b5dde922d967697b2bdd573aa2364da4f1b (diff) | |
Fixed #22234 -- Replaced OS-specific code with subprocess.call() in dbshell.
This fixes escaping of special characters on Windows.
| -rw-r--r-- | django/db/backends/mysql/client.py | 8 | ||||
| -rw-r--r-- | django/db/backends/oracle/client.py | 8 | ||||
| -rw-r--r-- | django/db/backends/postgresql_psycopg2/client.py | 8 | ||||
| -rw-r--r-- | django/db/backends/sqlite3/client.py | 8 |
4 files changed, 8 insertions, 24 deletions
diff --git a/django/db/backends/mysql/client.py b/django/db/backends/mysql/client.py index 8364c7b6e6..2106c4d3da 100644 --- a/django/db/backends/mysql/client.py +++ b/django/db/backends/mysql/client.py @@ -1,5 +1,4 @@ -import os -import sys +import subprocess from django.db.backends import BaseDatabaseClient @@ -34,7 +33,4 @@ class DatabaseClient(BaseDatabaseClient): if db: args += [db] - if os.name == 'nt': - sys.exit(os.system(" ".join(args))) - else: - os.execvp(self.executable_name, args) + subprocess.call(args) diff --git a/django/db/backends/oracle/client.py b/django/db/backends/oracle/client.py index ac6b79041f..75be718d6f 100644 --- a/django/db/backends/oracle/client.py +++ b/django/db/backends/oracle/client.py @@ -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) diff --git a/django/db/backends/postgresql_psycopg2/client.py b/django/db/backends/postgresql_psycopg2/client.py index 23ac9f2975..b4189da0f6 100644 --- a/django/db/backends/postgresql_psycopg2/client.py +++ b/django/db/backends/postgresql_psycopg2/client.py @@ -1,5 +1,4 @@ -import os -import sys +import subprocess from django.db.backends import BaseDatabaseClient @@ -17,7 +16,4 @@ class DatabaseClient(BaseDatabaseClient): 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) diff --git a/django/db/backends/sqlite3/client.py b/django/db/backends/sqlite3/client.py index 6a3ad9e76f..6553dced65 100644 --- a/django/db/backends/sqlite3/client.py +++ b/django/db/backends/sqlite3/client.py @@ -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) |
