This repository was archived by the owner on Dec 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed
Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ public void Run()
104104
105105 try
106106 {
107- Logger . Trace ( $ "Running '{ Process . StartInfo . FileName . ToNPath ( ) . FileName } { taskName } '") ;
107+ Logger . Trace ( $ "Running '{ Process . StartInfo . FileName } { taskName } '") ;
108108
109109 Process . Start ( ) ;
110110
@@ -154,9 +154,11 @@ public void Run()
154154 }
155155 }
156156 }
157- catch ( Win32Exception ex )
157+ catch ( Exception ex )
158158 {
159- var errorCode = ex . NativeErrorCode ;
159+ var errorCode = - 42 ;
160+ if ( ex is Win32Exception )
161+ errorCode = ( ( Win32Exception ) ex ) . NativeErrorCode ;
160162
161163 StringBuilder sb = new StringBuilder ( ) ;
162164 if ( Process . StartInfo . Arguments . Contains ( "-credential" ) )
@@ -172,12 +174,6 @@ public void Run()
172174 }
173175 thrownException = new ProcessException ( errorCode , sb . ToString ( ) , ex ) ;
174176 }
175- catch ( Exception ex )
176- {
177- thrownException = new ProcessException ( Process . HasExited ? Process . ExitCode : - 42 ,
178- "Unknown error" ,
179- ex ) ;
180- }
181177
182178 if ( thrownException != null || errors . Count > 0 )
183179 onError ? . Invoke ( thrownException , string . Join ( Environment . NewLine , errors . ToArray ( ) ) ) ;
You can’t perform that action at this time.
0 commit comments