[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: rev 5577 - in trunk/subversion: libsvn_client tests/clients/cmdline

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2003-04-07 23:19:57 CEST

Branko ÄŒibej <brane@xbc.nu> writes:

> Philip Martin wrote:
>
> >Strictly speaking all I wanted to test was that the client didn't
> >crash, but I had to explicitly check the output because the
> >run_and_verify_svn function didn't raise an error when svn dumped
> >core. Is run_and_verify_svn supposed to ignore a client that crashes?
>
> It can't detect a crash, thanks to the way Python does os.popen. It
> can't even detect a non-zero return value from a spawned program.

After that hint I found this patch

http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgId=182328

which adds platform specific code that uses Popen3() to get additional
error checking. The patch may be out of date by now but the approach
looks reasonable to me, although I don't know much about Python.
There don't appear to have been any substantial comments on the
original patch. Are there any objections to the approach in the
patch, which in essence is

- infile, outfile, errfile = os.popen3(command)
- stdout_lines = outfile.readlines()
- stderr_lines = errfile.readlines()
-
- outfile.close()
- infile.close()
- errfile.close()
-
+ if windows:
+ infile, outfile, errfile = os.popen3(command)
+ stdout_lines = outfile.readlines()
+ stderr_lines = errfile.readlines()
+ outfile.close()
+ infile.close()
+ errfile.close()
+ else:
+ child = popen2.Popen3(command, 1)
+ stdout_lines = child.fromchild.readlines()
+ stderr_lines = child.childerr.readlines()
+ result = child.wait();
+ if os.WIFSIGNALED(result):
+ print "svn got signal: " + str(os.WTERMSIG(result))
+ raise SVNUnexpectedError
+ if (not error_expected) and os.WIFEXITED(result) and os.WEXITSTATUS(result):
+ map(sys.stdout.write, stderr_lines)
+ print "svn exit status: " + str(os.WEXITSTATUS(result))
+ raise SVNUnexpectedError

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Apr 7 23:20:49 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.