File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -1712,7 +1712,14 @@ def _checkpoint(self, flags=''):
17121712 # simply do a non-blocking read). Very little data will be
17131713 # coming in anyway, so doing this a byte at a time is an
17141714 # irrelevant inefficiency
1715- byte = self .gnuplotProcess .stderr .read (1 ).decode ()
1715+ byte = self .gnuplotProcess .stderr .read (1 )
1716+ if len (byte ) == 0 :
1717+ # Did the child process die?
1718+ returncode = self .gnuplotProcess .poll ()
1719+ if returncode is not None :
1720+ # Yep. It died.
1721+ raise Exception (f"gnuplot child died. returncode = { returncode } " )
1722+ byte = byte .decode ()
17161723 fromerr += byte
17171724 if byte is not None and len (byte ):
17181725 self ._logEvent ("Read byte '{}' ({}) from gnuplot child process" .format (byte ,
@@ -1728,7 +1735,10 @@ def _checkpoint(self, flags=''):
17281735
17291736 self ._logEvent (f"Read string from gnuplot: '{ fromerr } '" )
17301737
1731- fromerr = re .search (r'\s*(.*?)\s*{}$' .format (checkpoint ), fromerr , re .M + re .S ).group (1 )
1738+ m = re .search (rf'\s*(.*?)\s*{ checkpoint } $' , fromerr , re .M + re .S )
1739+ if m is None :
1740+ raise Exception (f"checkpoint '{ checkpoint } ' not found in received string '{ fromerr } '" )
1741+ fromerr = m .group (1 )
17321742
17331743 warningre = re .compile (r'^\s*(.*?(?:warning|undefined).*?)\s*$' , re .M + re .I )
17341744 warnings = warningre .findall (fromerr )
You can’t perform that action at this time.
0 commit comments