0000993: Checkpoint tool crashes in Windows

svn: r8352
This commit is contained in:
Brian Matherly 2007-04-05 02:54:03 +00:00
parent 2fb4abbb1f
commit 60e09c86eb
2 changed files with 32 additions and 19 deletions

View File

@ -1,3 +1,6 @@
2007-04-04 Brian Matherly <brian@gramps-project.org>
* src/plugins/Checkpoint.py: 0000993: Checkpoint tool crashes in Windows
2007-04-04 Don Allingham <don@gramps-project.org> 2007-04-04 Don Allingham <don@gramps-project.org>
* src/DateHandler/_DateParser.py: fix text string that contians a valid * src/DateHandler/_DateParser.py: fix text string that contians a valid
modifier. modifier.

View File

@ -28,7 +28,7 @@
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import os import os
import popen2 import subprocess
import locale import locale
import time import time
from gettext import gettext as _ from gettext import gettext as _
@ -236,15 +236,19 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow):
""" """
Passed the generated XML file to the specified command. Passed the generated XML file to the specified command.
""" """
proc = popen2.Popen3(cmd, True) proc = subprocess.Popen(
cmd,
stderr = subprocess.PIPE,
stdin = subprocess.PIPE )
if checkin: if checkin:
xmlwrite = GrampsDb.XmlWriter(self.db,self.callback,False,False) xmlwrite = GrampsDb.XmlWriter(self.db,self.callback,False,False)
xmlwrite.write_handle(proc.tochild) xmlwrite.write_handle(proc.stdin)
else: else:
pass pass
proc.tochild.close() proc.stdin.close()
status = proc.wait() status = proc.wait()
message = "\n".join(proc.childerr.readlines()) message = "\n".join(proc.stderr.readlines())
proc.stderr.close()
del proc del proc
if checkin: if checkin:
@ -286,12 +290,12 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow):
# If the archive file does not exist, we either set it up # If the archive file does not exist, we either set it up
# or die trying # or die trying
if not os.path.exists(archive): if not os.path.exists(archive):
proc = popen2.Popen3( proc = subprocess.Popen(
'rcs -i -U -q -t-"GRAMPS database" %s' % archive, 'rcs -i -U -q -t-"GRAMPS database" %s' % archive,
True) stderr = subprocess.PIPE )
proc.tochild.close()
status = proc.wait() status = proc.wait()
message = "\n".join(proc.childerr.readlines()) message = "\n".join(proc.stderr.readlines())
proc.stderr.close()
del proc del proc
if status: if status:
@ -317,11 +321,15 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow):
xmlwrite = GrampsDb.XmlWriter(self.db,self.callback,False,False) xmlwrite = GrampsDb.XmlWriter(self.db,self.callback,False,False)
xmlwrite.write(archive_base) xmlwrite.write(archive_base)
proc = popen2.Popen3("ci %s" % archive_base,True) proc = subprocess.Popen(
proc.tochild.write(comment) "ci %s" % archive_base,
proc.tochild.close() stdin = subprocess.PIPE,
stderr = subprocess.PIPE )
proc.stdin.write(comment)
proc.stdin.close()
status = proc.wait() status = proc.wait()
message = "\n".join(proc.childerr.readlines()) message = "\n".join(proc.stderr.readlines())
proc.stderr.close()
del proc del proc
if status: if status:
@ -339,13 +347,15 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow):
else: else:
dialog(msg1,msg2) dialog(msg1,msg2)
else: else:
proc = popen2.Popen3("co -p %s > %s.gramps"
% (archive_base,archive_base), proc = subprocess.Popen(
True) "co -p %s > %s.gramps" % (archive_base,archive_base),
proc.tochild.close() stderr = subprocess.PIPE )
status = proc.wait() status = proc.wait()
message = "\n".join(proc.childerr.readlines()) message = "\n".join(proc.stderr.readlines())
proc.stderr.close()
del proc del proc
if status: if status:
msg1 = retrieve_failure_msg[0] msg1 = retrieve_failure_msg[0]
msg2 = retrieve_failure_msg[1] % message msg2 = retrieve_failure_msg[1] % message