Skip to content

Commit

Permalink
尝试配置不需要 cmd 调用进程但没有实现
Browse files Browse the repository at this point in the history
  • Loading branch information
lindexi committed May 11, 2024
1 parent 61b08f8 commit f38aa30
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions package/GitCommand/GitCommand/Git.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,33 @@ private string FileStr()
/// 大部分中文环境开发机上都是用 GBK 编码输出,我这个库也基本上是被我自己使用,设置为 GBK 很合理
public Encoding StandardOutputEncoding { set; get; } = Encoding.GetEncoding("GBK");

/// <summary>
/// 使用需要使用 cmd 来调用 git 命令
/// </summary>
public bool ShouldCallCommandLineWithCmd
{
set => _shouldCallCommandLineWithCmd = false;
get
{
if (OperatingSystem.IsWindows())
{
return _shouldCallCommandLineWithCmd ?? true;
}

// 其他平台也没有 cmd 可以用
return false;
}
}

private bool? _shouldCallCommandLineWithCmd;

private string Command(string str, string workingDirectory)
{
if (!ShouldCallCommandLineWithCmd)
{
var processStartInfo = new ProcessStartInfo("git");
}

// string str = Console.ReadLine();
//System.Console.InputEncoding = System.Text.Encoding.UTF8;//乱码

Expand Down

0 comments on commit f38aa30

Please sign in to comment.