@@ -33,77 +33,6 @@ public enum EditorType
33
33
public bool RaiseError { get ; set ; } = true ;
34
34
public Models . ICommandLog Log { get ; set ; } = null ;
35
35
36
- public bool Exec ( )
37
- {
38
- Log ? . AppendLine ( $ "$ git { Args } \n ") ;
39
-
40
- var start = CreateGitStartInfo ( ) ;
41
- var errs = new List < string > ( ) ;
42
- var proc = new Process ( ) { StartInfo = start } ;
43
-
44
- proc . OutputDataReceived += ( _ , e ) => HandleOutput ( e . Data , errs ) ;
45
- proc . ErrorDataReceived += ( _ , e ) => HandleOutput ( e . Data , errs ) ;
46
-
47
- var dummy = null as Process ;
48
- var dummyProcLock = new object ( ) ;
49
- try
50
- {
51
- proc . Start ( ) ;
52
-
53
- // It not safe, please only use `CancellationToken` in readonly commands.
54
- if ( CancellationToken . CanBeCanceled )
55
- {
56
- dummy = proc ;
57
- CancellationToken . Register ( ( ) =>
58
- {
59
- lock ( dummyProcLock )
60
- {
61
- if ( dummy is { HasExited : false } )
62
- dummy . Kill ( ) ;
63
- }
64
- } ) ;
65
- }
66
- }
67
- catch ( Exception e )
68
- {
69
- if ( RaiseError )
70
- App . RaiseException ( Context , e . Message ) ;
71
-
72
- Log ? . AppendLine ( string . Empty ) ;
73
- return false ;
74
- }
75
-
76
- proc . BeginOutputReadLine ( ) ;
77
- proc . BeginErrorReadLine ( ) ;
78
- proc . WaitForExit ( ) ;
79
-
80
- if ( dummy != null )
81
- {
82
- lock ( dummyProcLock )
83
- {
84
- dummy = null ;
85
- }
86
- }
87
-
88
- int exitCode = proc . ExitCode ;
89
- proc . Close ( ) ;
90
- Log ? . AppendLine ( string . Empty ) ;
91
-
92
- if ( ! CancellationToken . IsCancellationRequested && exitCode != 0 )
93
- {
94
- if ( RaiseError )
95
- {
96
- var errMsg = string . Join ( "\n " , errs ) . Trim ( ) ;
97
- if ( ! string . IsNullOrEmpty ( errMsg ) )
98
- App . RaiseException ( Context , errMsg ) ;
99
- }
100
-
101
- return false ;
102
- }
103
-
104
- return true ;
105
- }
106
-
107
36
public ReadToEndResult ReadToEnd ( )
108
37
{
109
38
var start = CreateGitStartInfo ( ) ;
0 commit comments