Added safe subprocess handling to prevent blocked threads.
Added safe subprocess handling to prevent blocked threads.

The patch subprocess waits for input from stdin, and if Review Board hits
and exception before it can provide that stdin, the process will continue
to wait in the background.

Testing done:
Manual at this point.  I set a breakpoint just before we call the patch process,
and then set the diff variable to None (not the empty string, mind you, but
None).  This triggered the blocking patch process for me.

Anyhow, with this patch, that blocking process gets cleared.

If anybody has any ideas on how I might more accurately reproduce the problem in
issue 1862, please let me know, and I'll write a real test for it.

Addresses issue #1862.

Reviewed at http://reviews.reviewboard.org/r/2620/

chipx86/reviewboard,custode/reviewboard,chipx86/reviewboard,davidt/reviewboard,bkochendorfer/reviewboard,bkochendorfer/reviewboard,Khan/reviewboard,custode/reviewboard,davidt/reviewboard,atagar/ReviewBoard,1tush/reviewboard,Khan/reviewboard,custode/reviewboard,davidt/reviewboard,1tush/reviewboard,1tush/reviewboard,sgallagher/reviewboard,reviewboard/reviewboard,sgallagher/reviewboard,Khan/reviewboard,Khan/reviewboard,reviewboard/reviewboard,custode/reviewboard,KnowNo/reviewboard,atagar/ReviewBoard,chipx86/reviewboard,brennie/reviewboard,beol/reviewboard,atagar/ReviewBoard,Khan/reviewboard,Khan/reviewboard,beol/reviewboard,sgallagher/reviewboard,reviewboard/reviewboard,atagar/ReviewBoard,1tush/reviewboard,atagar/ReviewBoard,KnowNo/reviewboard,beol/reviewboard,chipx86/reviewboard,reviewboard/reviewboard,1tush/reviewboard,davidt/reviewboard,KnowNo/reviewboard,Khan/reviewboard,beol/reviewboard,1tush/reviewboard,Khan/reviewboard,1tush/reviewboard,1tush/reviewboard,brennie/reviewboard,brennie/reviewboard,atagar/ReviewBoard,1tush/reviewboard,Khan/reviewboard,atagar/ReviewBoard,brennie/reviewboard,bkochendorfer/reviewboard,bkochendorfer/reviewboard,atagar/ReviewBoard,KnowNo/reviewboard,sgallagher/reviewboard,atagar/ReviewBoard