openerp-community team mailing list archive
-
openerp-community team
-
Mailing list archive
-
Message #00608
lp:~openerp-community/openobject-server/stefan-therp_lp879872-6.1 into lp:openobject-server
Stefan Rijnhart (Therp) has proposed merging lp:~openerp-community/openobject-server/stefan-therp_lp879872-6.1 into lp:openobject-server.
Requested reviews:
OpenERP Core Team (openerp)
Related bugs:
Bug #879872 in OpenERP Server: "Does not check return value of pg_restore"
https://bugs.launchpad.net/openobject-server/+bug/879872
For more details, see:
https://code.launchpad.net/~openerp-community/openobject-server/stefan-therp_lp879872-6.1/+merge/80125
This branch slightly modifies the code around the pg_restore command, so that any error condition is properly signalled.
--
https://code.launchpad.net/~openerp-community/openobject-server/stefan-therp_lp879872-6.1/+merge/80125
Your team OpenERP Community is subscribed to branch lp:~openerp-community/openobject-server/stefan-therp_lp879872-6.1.
=== modified file 'openerp/service/web_services.py'
--- openerp/service/web_services.py 2011-10-13 10:47:50 +0000
+++ openerp/service/web_services.py 2011-10-22 12:02:24 +0000
@@ -213,10 +213,10 @@
cmd.append('--port=' + str(tools.config['db_port']))
cmd.append(db_name)
- stdin, stdout = tools.exec_pg_command_pipe(*tuple(cmd))
- stdin.close()
- data = stdout.read()
- res = stdout.close()
+ pop = tools.exec_pg_command_pipe(*tuple(cmd))
+ pop.stdin.close()
+ data = pop.stdout.read()
+ res = pop.wait()
if res:
logger.notifyChannel("web-services", netsvc.LOG_ERROR,
'DUMP DB: %s failed\n%s' % (db_name, data))
@@ -257,11 +257,11 @@
args2=list(args2)
args2.append(' ' + tmpfile)
args2=tuple(args2)
- stdin, stdout = tools.exec_pg_command_pipe(*args2)
+ pop = tools.exec_pg_command_pipe(*args2)
if not os.name == "nt":
- stdin.write(base64.decodestring(data))
- stdin.close()
- res = stdout.close()
+ pop.stdin.write(base64.decodestring(data))
+ pop.stdin.close()
+ res = pop.wait()
if res:
raise Exception, "Couldn't restore database"
logger.notifyChannel("web-services", netsvc.LOG_INFO,
=== modified file 'openerp/tools/misc.py'
--- openerp/tools/misc.py 2011-09-22 09:54:43 +0000
+++ openerp/tools/misc.py 2011-10-22 12:02:24 +0000
@@ -103,10 +103,9 @@
raise Exception('Couldn\'t find %s' % name)
# on win32, passing close_fds=True is not compatible
# with redirecting std[in/err/out]
- pop = subprocess.Popen((prog,) + args, bufsize= -1,
+ return subprocess.Popen((prog,) + args, bufsize= -1,
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
close_fds=(os.name=="posix"))
- return (pop.stdin, pop.stdout)
def exec_command_pipe(name, *args):
prog = find_in_path(name)
Follow ups