diff --git a/trytond/backend/postgresql/database.py b/trytond/backend/postgresql/database.py index 07ad939dc7..4dfe2a4271 100644 --- a/trytond/backend/postgresql/database.py +++ b/trytond/backend/postgresql/database.py @@ -94,10 +94,10 @@ class Database(DatabaseInterface): cmd.append('--port=' + CONFIG['db_port']) cmd.append(database_name) - stdin, stdout = exec_pg_command_pipe(*tuple(cmd)) - stdin.close() - data = stdout.read() - res = stdout.close() + pipe = exec_pg_command_pipe(*tuple(cmd)) + pipe.stdin.close() + data = pipe.stdout.read() + res = pipe.wait() if res: raise Exception('Couldn\'t dump database!') return data @@ -129,11 +129,11 @@ class Database(DatabaseInterface): args2.append(' ' + tmpfile) args2 = tuple(args2) - stdin, stdout = exec_pg_command_pipe(*args2) + pipe = exec_pg_command_pipe(*args2) if not os.name == "nt": - stdin.write(data) - stdin.close() - res = stdout.close() + pipe.stdin.write(data) + pipe.stdin.close() + res = pipe.wait() if res: raise Exception('Couldn\'t restore database') diff --git a/trytond/tools/misc.py b/trytond/tools/misc.py index 245a5b1b9d..1381c70c7c 100644 --- a/trytond/tools/misc.py +++ b/trytond/tools/misc.py @@ -63,7 +63,7 @@ def exec_pg_command_pipe(name, *args): stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True, env=child_env) - return (pipe.stdin, pipe.stdout) + return pipe def exec_command_pipe(name, *args): prog = find_in_path(name)