Fix call to exec_pg_command_pipe to wait the end of the command

This commit is contained in:
Cédric Krier committed 2009-09-02 17:38:06 +02:00
1 parent 12360f178a
commit 2372e64abd
2 files changed
+9 -9

No files matched your search

+8 -8
View File
@@ -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')
+1 -1
View File
@@ -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)