repo git: don't hang on huge command outputs
This commit is contained in:
parent
c498347931
commit
0944efe992
|
@ -137,7 +137,6 @@ namespace SparkleLib {
|
||||||
Commit (message);
|
Commit (message);
|
||||||
|
|
||||||
SparkleGit git = new SparkleGit (LocalPath, "push origin master");
|
SparkleGit git = new SparkleGit (LocalPath, "push origin master");
|
||||||
|
|
||||||
git.Start ();
|
git.Start ();
|
||||||
git.WaitForExit ();
|
git.WaitForExit ();
|
||||||
|
|
||||||
|
@ -168,9 +167,12 @@ namespace SparkleLib {
|
||||||
get {
|
get {
|
||||||
SparkleGit git = new SparkleGit (LocalPath, "status --porcelain");
|
SparkleGit git = new SparkleGit (LocalPath, "status --porcelain");
|
||||||
git.Start ();
|
git.Start ();
|
||||||
|
|
||||||
|
// Reading the standard output HAS to go before
|
||||||
|
// WaitForExit, or it will hang forever on output > 4096 bytes
|
||||||
|
string output = git.StandardOutput.ReadToEnd ().TrimEnd ();
|
||||||
git.WaitForExit ();
|
git.WaitForExit ();
|
||||||
|
|
||||||
string output = git.StandardOutput.ReadToEnd ().TrimEnd ();
|
|
||||||
string [] lines = output.Split ("\n".ToCharArray ());
|
string [] lines = output.Split ("\n".ToCharArray ());
|
||||||
|
|
||||||
foreach (string line in lines) {
|
foreach (string line in lines) {
|
||||||
|
@ -300,9 +302,12 @@ namespace SparkleLib {
|
||||||
|
|
||||||
SparkleGit git_status = new SparkleGit (LocalPath, "status --porcelain");
|
SparkleGit git_status = new SparkleGit (LocalPath, "status --porcelain");
|
||||||
git_status.Start ();
|
git_status.Start ();
|
||||||
git_status.WaitForExit ();
|
|
||||||
|
|
||||||
string output = git_status.StandardOutput.ReadToEnd ().TrimEnd ();
|
// Reading the standard output HAS to go before
|
||||||
|
// WaitForExit, or it will hang forever on output > 4096 bytes
|
||||||
|
string output = git_status.StandardOutput.ReadToEnd ().TrimEnd ();
|
||||||
|
git.WaitForExit ();
|
||||||
|
|
||||||
string [] lines = output.Split ("\n".ToCharArray ());
|
string [] lines = output.Split ("\n".ToCharArray ());
|
||||||
|
|
||||||
foreach (string line in lines) {
|
foreach (string line in lines) {
|
||||||
|
|
Loading…
Reference in a new issue