From 4c111c0be1c74d54e0bf85f94b6bdf41319185bf Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 19 Jan 2011 16:01:14 +0100 Subject: [PATCH] [FIX] tools.misc: win32 compatibility for the new subprocess code bzr revid: odo@openerp.com-20110119150114-8c5yr38nwaa8yex5 --- bin/tools/misc.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bin/tools/misc.py b/bin/tools/misc.py index d18090932dc..615893ef238 100644 --- a/bin/tools/misc.py +++ b/bin/tools/misc.py @@ -162,16 +162,22 @@ def exec_pg_command_pipe(name, *args): prog = find_pg_tool(name) if not prog: 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, - stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True) + 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) if not prog: 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, - stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True) + stdin=subprocess.PIPE, stdout=subprocess.PIPE, + close_fds=(os.name=="posix")) return (pop.stdin, pop.stdout) #----------------------------------------------------------