File tree 1 file changed +18
-23
lines changed
src/PowerShellEditorServices/Services/PowerShell/Execution
1 file changed +18
-23
lines changed Original file line number Diff line number Diff line change @@ -55,10 +55,7 @@ public TResult Result
55
55
throw new OperationCanceledException ( ) ;
56
56
}
57
57
58
- if ( _exceptionInfo is not null )
59
- {
60
- _exceptionInfo . Throw ( ) ;
61
- }
58
+ _exceptionInfo ? . Throw ( ) ;
62
59
63
60
return _result ;
64
61
}
@@ -79,27 +76,25 @@ public void ExecuteSynchronously(CancellationToken executorCancellationToken)
79
76
return ;
80
77
}
81
78
82
- using ( var cancellationSource = CancellationTokenSource . CreateLinkedTokenSource ( _taskRequesterCancellationToken , executorCancellationToken ) )
79
+ using var cancellationSource = CancellationTokenSource . CreateLinkedTokenSource ( _taskRequesterCancellationToken , executorCancellationToken ) ;
80
+ if ( cancellationSource . IsCancellationRequested )
83
81
{
84
- if ( cancellationSource . IsCancellationRequested )
85
- {
86
- SetCanceled ( ) ;
87
- return ;
88
- }
82
+ SetCanceled ( ) ;
83
+ return ;
84
+ }
89
85
90
- try
91
- {
92
- TResult result = Run ( cancellationSource . Token ) ;
93
- SetResult ( result ) ;
94
- }
95
- catch ( OperationCanceledException )
96
- {
97
- SetCanceled ( ) ;
98
- }
99
- catch ( Exception e )
100
- {
101
- SetException ( e ) ;
102
- }
86
+ try
87
+ {
88
+ TResult result = Run ( cancellationSource . Token ) ;
89
+ SetResult ( result ) ;
90
+ }
91
+ catch ( OperationCanceledException )
92
+ {
93
+ SetCanceled ( ) ;
94
+ }
95
+ catch ( Exception e )
96
+ {
97
+ SetException ( e ) ;
103
98
}
104
99
}
105
100
You can’t perform that action at this time.
0 commit comments