utility method to handle the result of getProcessOutputAndValue
191737
def _convertNonZeroToFailure(self, res):
        ""
        (stdout, stderr, code) = res
        if code != 0:
            raise EnvironmentError(
                'command failed with exit code %d: %s' % (code, stderr))
        return (stdout, stderr, code)
813581
def get_result(self):
        
        self._process()
        if not self.has_result:
            raise NoResult
        return self.res_queue.popleft()
1031641
String getProcErrorOutput(Process proc) throws IOException {
        StringBuffer output = new StringBuffer();

        InputStream procIn = proc.getInputStream();
        int read;
        // Dump the data printed by the process
        do {
            byte[] buffer = new byte[BUFFER_SIZE];
            read = procIn.read(buffer);
            String s = new String(buffer);
            output.append(s);
        } while (read == BUFFER_SIZE);

        return output.toString();
    }
478283
def process_result_value(self, value: Optional[str],
                             dialect: Dialect) -> List[str]:
        """"""
        retval = self._dbstr_to_strlist(value)
        return retval
117247
def process_result_value(self, value, dialect):
        
        if value is None:
            return None

        p = value.split("|")

        if len(p) == 0:
            return None
        return SourceLocation(*map(int, p))
59389
def _gen_result_handler(self):
        
        while True:
            try:
                data = self._client.read_until(self.SEPARATOR)
            except:
                raise
            else:
                response = self.decoder(data)
                code = response.get("CODE")
                res = response.get("MESSAGE")
                if code == 202:
                    result = res.get('RESULT')
                    yield result
                if code == 206:
                    break
843212
def _handle_dbproc_call(self, parts, parameters_metadata):
        """"""
        for part in parts:
            if part.kind == part_kinds.ROWSAFFECTED:
                self.rowcount = part.values[0]
            elif part.kind == part_kinds.TRANSACTIONFLAGS:
                pass
            elif part.kind == part_kinds.STATEMENTCONTEXT:
                pass
            elif part.kind == part_kinds.OUTPUTPARAMETERS:
                self._buffer = part.unpack_rows(parameters_metadata, self.connection)
                self._received_last_resultset_part = True
                self._executed = True
            elif part.kind == part_kinds.RESULTSETMETADATA:
                self.description, self._column_types = self._handle_result_metadata(part)
            elif part.kind == part_kinds.RESULTSETID:
                self._resultset_id = part.value
            elif part.kind == part_kinds.RESULTSET:
                self._buffer = part.unpack_rows(self._column_types, self.connection)
                self._received_last_resultset_part = part.attribute & 1
                self._executed = True
            else:
                raise InterfaceError("Stored procedure call, unexpected part kind %d." % part.kind)
        self._executed = True
1002080
public void doProcessOutput(BasicServlet servlet, HttpServletRequest req, HttpServletResponse res, PrintWriter outExt, ScreenModel screen) 
        throws ServletException, IOException
    {
        PrintWriter out = outExt;
        if (screen == null)
        {
        	if (out != null)
        		out.println("Error: default screen not available");
        }
        else
        {
            try
            { // create and execute the query
                // if no parameters, just print the form
                String strDatatype = this.getProperty(DBParams.DATATYPE); // Raw data (such as in image from the DB)
                if (strDatatype == null)
                {
                    if (out == null)
                        out = servlet.getOutputStream(res); // Always
                    ((ScreenModel)screen).printReport(out);
                }
                else
                {       // Raw data output
                    ((ScreenModel)screen).getScreenFieldView().sendData(req, res);
                }
                screen.free();
                screen = null;
            }
            catch (DBException ex) {
                if (out != null)
                {
                    out.println("<hr>*** SQLException caught ***<p>");
                    out.println("Message:  " + ex.getMessage() + "<br>");
                    ex.printStackTrace(out);
                }
                ex.printStackTrace();
            }
            catch (java.lang.Exception ex) {
                ex.printStackTrace();
            } finally {
            	if (outExt == null)
            		if (out != null)
            			out.close();
            }
        }
    }
1149394
public static String getErrorResult(Process process, Charset charset) {
		InputStream in = null;
		try {
			in = process.getErrorStream();
			return IoUtil.read(in, charset);
		} finally {
			IoUtil.close(in);
			destroy(process);
		}
	}
985909
def get_value(self, name):
        """"""
        code = u"get_ipython().kernel.get_value('%s')" % name
        if self._reading:
            method = self.kernel_client.input
            code = u'!' + code
        else:
            method = self.silent_execute

        # Wait until the kernel returns the value
        wait_loop = QEventLoop()
        self.sig_got_reply.connect(wait_loop.quit)
        method(code)
        wait_loop.exec_()

        # Remove loop connection and loop
        self.sig_got_reply.disconnect(wait_loop.quit)
        wait_loop = None

        # Handle exceptions
        if self._kernel_value is None:
            if self._kernel_reply:
                msg = self._kernel_reply[:]
                self._kernel_reply = None
                raise ValueError(msg)

        return self._kernel_value
255790
private void processSource(Context cx, String filename)
    {
        if (filename == null) {
            BufferedReader in = new BufferedReader
                (new InputStreamReader(System.in));
            String sourceName = "<stdin>";
            int lineno = 1;
            boolean hitEOF = false;
            do {
                int startline = lineno;
                System.err.print("js> ");
                System.err.flush();
                try {
                    String source = "";
                    // Collect lines of source to compile.
                    while(true) {
                        String newline;
                        newline = in.readLine();
                        if (newline == null) {
                            hitEOF = true;
                            break;
                        }
                        source = source + newline + "\n";
                        lineno++;
                        // Continue collecting as long as more lines
                        // are needed to complete the current
                        // statement.  stringIsCompilableUnit is also
                        // true if the source statement will result in
                        // any error other than one that might be
                        // resolved by appending more source.
                        if (cx.stringIsCompilableUnit(source))
                            break;
                    }
                    Object result = cx.evaluateString(this, source,
                                                      sourceName, startline,
                                                      null);
                    if (result != Context.getUndefinedValue()) {
                        System.err.println(Context.toString(result));
                    }
                }
                catch (WrappedException we) {
                    // Some form of exception was caught by JavaScript and
                    // propagated up.
                    System.err.println(we.getWrappedException().toString());
                    we.printStackTrace();
                }
                catch (EvaluatorException ee) {
                    // Some form of JavaScript error.
                    System.err.println("js: " + ee.getMessage());
                }
                catch (JavaScriptException jse) {
                    // Some form of JavaScript error.
                    System.err.println("js: " + jse.getMessage());
                }
                catch (IOException ioe) {
                    System.err.println(ioe.toString());
                }
                if (quitting) {
                    // The user executed the quit() function.
                    break;
                }
            } while (!hitEOF);
            System.err.println();
        } else {
            FileReader in = null;
            try {
                in = new FileReader(filename);
            }
            catch (FileNotFoundException ex) {
                Context.reportError("Couldn't open file \"" + filename + "\".");
                return;
            }

            try {
                // Here we evalute the entire contents of the file as
                // a script. Text is printed only if the print() function
                // is called.
                cx.evaluateReader(this, in, filename, 1, null);
            }
            catch (WrappedException we) {
                System.err.println(we.getWrappedException().toString());
                we.printStackTrace();
            }
            catch (EvaluatorException ee) {
                System.err.println("js: " + ee.getMessage());
            }
            catch (JavaScriptException jse) {
                System.err.println("js: " + jse.getMessage());
            }
            catch (IOException ioe) {
                System.err.println(ioe.toString());
            }
            finally {
                try {
                    in.close();
                }
                catch (IOException ioe) {
                    System.err.println(ioe.toString());
                }
            }
        }
    }
703624
@Override
    public void validateProcessOutput(FaxClientSpi faxClientSpi,ProcessOutput processOutput,FaxActionType faxActionType)
    {
        //call exit code validation
        super.validateProcessOutput(faxClientSpi,processOutput,faxActionType);

        //get output
        String output=processOutput.getOutputText();

        if((output!=null)&&(output.length()>0))
        {
            //if no valid done output was found
            if(output.indexOf(Fax4jExeConstants.OPERATION_OUTPUT_DONE.toString())==-1)
            {
                //get error message
                String prefix=Fax4jExeConstants.FAX_ERROR_OUTPUT_PREFIX.toString();
                int index=output.indexOf(prefix);
                int prefixLenght=prefix.length();
                String errorMessage=null;
                if(index!=-1)
                {
                    //get index
                    index=index+prefixLenght;

                    if(output.length()>index)
                    {
                        //get output
                        errorMessage=output.substring(index);
                        
                        errorMessage=errorMessage.trim();
                        index=errorMessage.indexOf("\n");
                        if(index!=-1)
                        {
                            errorMessage=errorMessage.substring(0,index);
                            errorMessage=errorMessage.trim();
                        }
                        
                        //ignore empty message
                        if(errorMessage.length()==0)
                        {
                            errorMessage=null;
                        }
                    }
                }
                
                if(errorMessage==null)
                {
                    throw new FaxException("Error while invoking fax4j.exe, no error message detected.\nNative Output:\n"+output);
                }
                throw new FaxException("Error while invoking fax4j.exe, error: "+errorMessage+"\nNative Output:\n"+output);
            }
        }
        else
        {
            throw new FaxException("Error while invoking fax4j.exe, no output detected.");
        }
    }
770884
def get_results(self):
        '''
        
        '''
        self._event.wait()
        if self._exception is not None:
            #
            # Well... rethrownig the exception caught in execute
            # but on the caller thread
            #
            raise self._exception  # pylint: disable=E0702
        return self._result
35458
@Override
	public RandomVariable getProcessValue(int timeIndex, int componentIndex) {
		// Thread safe lazy initialization
		synchronized(this) {
			if (discreteProcess == null || discreteProcess.length == 0) {
				doPrecalculateProcess();
			}
		}

		if(discreteProcess[timeIndex][componentIndex] == null) {
			throw new NullPointerException("Generation of process component " + componentIndex + " at time index " + timeIndex + " failed. Likely due to out of memory");
		}

		// Return value of process
		return discreteProcess[timeIndex][componentIndex];
	}
76591
def result(self):
        
        if not self.is_done():
            raise ValueError("Cannot get a result for a program that isn't completed.")

        if self._raw['status'] == 'CANCELLED':
            raise CancellationError(self._raw['result'])
        elif self._raw['status'] == 'ERROR':
            if self._machine == 'QVM':
                raise QVMError(self._raw['result'])
            elif self._machine == 'QPU':
                raise QPUError(self._raw['result'])
            elif self._machine == 'QUILC':
                raise QUILCError(self._raw['result'])
            else:
                raise UnknownApiError(self._raw['result'])

        if self._raw['program']['type'] == 'wavefunction':
            return Wavefunction.from_bit_packed_string(
                base64.b64decode(self._raw['result']), self._raw['program']['addresses'])
        elif self._raw['program']['type'] in ['multishot', 'multishot-measure', 'expectation']:
            return np.asarray(self._raw['result'])
        else:
            return self._raw['result']
11934
public RandomVariable getProcessValue(int timeIndex, int componentIndex)
	{
		if(timeIndex == 0) {
			return getInitialValue()[componentIndex];
		}

		// Lazy initialization, synchronized for thread safety
		synchronized(this) {
			if(discreteProcess == null || discreteProcess.length == 0) {
				doPrecalculateProcess();
			}
		}

		// Return value of process
		return discreteProcess[timeIndex][componentIndex];
	}
1199801
private JsonNode parseProcessOutput(String processOutput) {
        JsonNode credentialsJson = Jackson.jsonNodeOf(processOutput);

        if (!credentialsJson.isObject()) {
            throw new IllegalStateException("Process did not return a JSON object.");
        }

        JsonNode version = credentialsJson.get("Version");
        if (version == null || !version.isInt() || version.asInt() != 1) {
            throw new IllegalStateException("Unsupported credential version: " + version);
        }
        return credentialsJson;
    }