private IResponse Execute(IRequest request) { try { Process compiler = new Process(); compiler.StartInfo.FileName = "multichain-cli"; compiler.StartInfo.Arguments = chainName + " " + request.GetCompleteMethodString(); compiler.StartInfo.UseShellExecute = false; compiler.StartInfo.RedirectStandardOutput = true; compiler.StartInfo.RedirectStandardError = true; compiler.Start(); compiler.WaitForExit(); var jsonIn = compiler.StandardOutput.ReadToEnd(); var errorIn = compiler.StandardError.ReadToEnd(); if (errorIn != "") throw new Exception(string.Format("Failed to issue JSON-RPC request. JSON: {0}, errorMessage: {1}",request.ToString(), errorIn)); // return... return request.GenerateResponse(jsonIn); } catch (Exception ex) { throw new InvalidOperationException(string.Format("Failed to issue JSON-RPC request. JSON: {0}",request.ToString()), ex); } }