Skip to content

Commit 2919433

Browse files
committed
code_style: only Commands.DiffTool needs synchronous method Exec
Signed-off-by: leo <[email protected]>
1 parent 29269b2 commit 2919433

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

src/Commands/Command.cs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,6 @@ public enum EditorType
3737
public bool RaiseError { get; set; } = true;
3838
public Models.ICommandLog Log { get; set; } = null;
3939

40-
public void Exec()
41-
{
42-
try
43-
{
44-
var start = CreateGitStartInfo(false);
45-
Process.Start(start);
46-
}
47-
catch (Exception ex)
48-
{
49-
App.RaiseException(Context, ex.Message);
50-
}
51-
}
52-
5340
public async Task<bool> ExecAsync()
5441
{
5542
Log?.AppendLine($"$ git {Args}\n");
@@ -171,7 +158,7 @@ protected async Task<Result> ReadToEndAsync()
171158
return rs;
172159
}
173160

174-
private ProcessStartInfo CreateGitStartInfo(bool redirect)
161+
protected ProcessStartInfo CreateGitStartInfo(bool redirect)
175162
{
176163
var start = new ProcessStartInfo();
177164
start.FileName = Native.OS.GitExecutable;

src/Commands/DiffTool.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
namespace SourceGit.Commands
1+
using System;
2+
using System.Diagnostics;
3+
4+
namespace SourceGit.Commands
25
{
36
public class DiffTool : Command
47
{
@@ -28,7 +31,14 @@ public void Open()
2831
Args = $"-c difftool.sourcegit.cmd={cmd.Quoted()} difftool --tool=sourcegit --no-prompt {_option}";
2932
}
3033

31-
Exec();
34+
try
35+
{
36+
Process.Start(CreateGitStartInfo(false));
37+
}
38+
catch (Exception ex)
39+
{
40+
App.RaiseException(Context, ex.Message);
41+
}
3242
}
3343

3444
private Models.DiffOption _option;

0 commit comments

Comments
 (0)