Subversion repository not working because of invalid xml from IO.popen
Added by netid netid almost 13 years ago
Hi,
I have setup my subversion repository in my redmine installation but the repository tab doesn't displays an error message. When I debugged the code, I found the issue is with the "svn list xml ...." command executed using IO.popen() method. The xml output of this method is passed to a block for parsing the xml where the xml is incomplete and the parser throws an error.
From what I guess is that the ruby program is not waiting for the popen() to finish but prematurely passing its incomplete xml output to its given block. How do I ensure that the popen() is finished before returning to the calling method.
Here is the code:
shellout(cmd) do |io| output = io.read begin doc = ActiveSupport::XmlMini.parse(output) rescue #log the error end end calls def self.shellout(cmd, &block) IO.popen(cmd, "r+") do |io| io.close_write block.call(io) if block_given? end end
Replies (1)
RE: Subversion repository not working because of invalid xml from IO.popen
-
Added by Mischa The Evil almost 13 years ago
What Redmine version are you using? See also submissions. Something similar was reported earlier as #6860, but fixed already a long time ago.