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()
104
104
105
105
try
106
106
{
107
- Logger . Trace ( $ "Running '{ Process . StartInfo . FileName . ToNPath ( ) . FileName } { taskName } '") ;
107
+ Logger . Trace ( $ "Running '{ Process . StartInfo . FileName } { taskName } '") ;
108
108
109
109
Process . Start ( ) ;
110
110
@@ -154,9 +154,11 @@ public void Run()
154
154
}
155
155
}
156
156
}
157
- catch ( Win32Exception ex )
157
+ catch ( Exception ex )
158
158
{
159
- var errorCode = ex . NativeErrorCode ;
159
+ var errorCode = - 42 ;
160
+ if ( ex is Win32Exception )
161
+ errorCode = ( ( Win32Exception ) ex ) . NativeErrorCode ;
160
162
161
163
StringBuilder sb = new StringBuilder ( ) ;
162
164
if ( Process . StartInfo . Arguments . Contains ( "-credential" ) )
@@ -172,12 +174,6 @@ public void Run()
172
174
}
173
175
thrownException = new ProcessException ( errorCode , sb . ToString ( ) , ex ) ;
174
176
}
175
- catch ( Exception ex )
176
- {
177
- thrownException = new ProcessException ( Process . HasExited ? Process . ExitCode : - 42 ,
178
- "Unknown error" ,
179
- ex ) ;
180
- }
181
177
182
178
if ( thrownException != null || errors . Count > 0 )
183
179
onError ? . Invoke ( thrownException , string . Join ( Environment . NewLine , errors . ToArray ( ) ) ) ;
You can’t perform that action at this time.
0 commit comments