@@ -147,47 +147,42 @@ protected string Execute(ProcessStartInfo startInfo)
147147 {
148148 try
149149 {
150- using ( var process = Process . Start ( startInfo ) )
150+ using var process = Process . Start ( startInfo ) ;
151+ if ( process == null )
151152 {
152- if ( process != null )
153+ Log . Error ( "|JsonRPCPlugin.Execute|Can't start new process" ) ;
154+ return string . Empty ;
155+ }
156+
157+ using var standardOutput = process . StandardOutput ;
158+ var result = standardOutput . ReadToEnd ( ) ;
159+ if ( string . IsNullOrEmpty ( result ) )
160+ {
161+ using ( var standardError = process . StandardError )
153162 {
154- using ( var standardOutput = process . StandardOutput )
163+ var error = standardError . ReadToEnd ( ) ;
164+ if ( ! string . IsNullOrEmpty ( error ) )
155165 {
156- var result = standardOutput . ReadToEnd ( ) ;
157- if ( string . IsNullOrEmpty ( result ) )
158- {
159- using ( var standardError = process . StandardError )
160- {
161- var error = standardError . ReadToEnd ( ) ;
162- if ( ! string . IsNullOrEmpty ( error ) )
163- {
164- Log . Error ( $ "|JsonRPCPlugin.Execute|{ error } ") ;
165- return string . Empty ;
166- }
167- else
168- {
169- Log . Error ( "|JsonRPCPlugin.Execute|Empty standard output and standard error." ) ;
170- return string . Empty ;
171- }
172- }
173- }
174- else if ( result . StartsWith ( "DEBUG:" ) )
175- {
176- MessageBox . Show ( new Form { TopMost = true } , result . Substring ( 6 ) ) ;
177- return string . Empty ;
178- }
179- else
180- {
181- return result ;
182- }
166+ Log . Error ( $ "|JsonRPCPlugin.Execute|{ error } ") ;
167+ return string . Empty ;
168+ }
169+ else
170+ {
171+ Log . Error ( "|JsonRPCPlugin.Execute|Empty standard output and standard error." ) ;
172+ return string . Empty ;
183173 }
184- }
185- else
186- {
187- Log . Error ( "|JsonRPCPlugin.Execute|Can't start new process" ) ;
188- return string . Empty ;
189174 }
190175 }
176+ else if ( result . StartsWith ( "DEBUG:" ) )
177+ {
178+ MessageBox . Show ( new Form { TopMost = true } , result . Substring ( 6 ) ) ;
179+ return string . Empty ;
180+ }
181+ else
182+ {
183+ return result ;
184+ }
185+
191186 }
192187 catch ( Exception e )
193188 {
0 commit comments