Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show progress in git based installs #641

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified run.n
Binary file not shown.
18 changes: 17 additions & 1 deletion src/haxelib/api/Vcs.hx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/
package haxelib.api;

import haxelib.client.Cli;
import haxelib.VersionData.VcsData;
import sys.FileSystem;
import sys.thread.Thread;
Expand Down Expand Up @@ -193,6 +194,18 @@ abstract class Vcs implements IVcs {
// just in case process hangs waiting for stdin
p.stdin.close();

// In certain cases of git clones, it will hang on reading from stderr
// if we don't read from it. So we will always try to read from it.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason this was solved with threads on windows is that the same thing could happen with p.stdout and p.stderr at the same time, in which case the only solution is to read from both simultaneously (with separate threads).

However, the threads caused issues on Linux so I made it windows only in: b8c24a7. I suspect the same issue is also behind these crashes: #591

try {
while (true) {
Sys.stdout().writeByte(p.stderr.readByte());
Sys.stdout().flush();
}
}
catch (e:haxe.io.Eof) {
// We're done reading this processes stderr
}

final ret = if (Sys.systemName() == "Windows") {
final streamsLock = new sys.thread.Lock();
function readFrom(stream:haxe.io.Input, to:{value:String}) {
Expand Down Expand Up @@ -323,7 +336,10 @@ class Git extends Vcs {
public function clone(libPath:String, url:String, ?branch:String, ?version:String, ?debugLog:(msg:String)->Void):Void {
final oldCwd = Sys.getCwd();

final vcsArgs = ["clone", url, libPath];
var vcsArgs = ["clone", url, libPath];

if (Cli.mode != Quiet)
vcsArgs.push("--progress");

if (!Vcs.flat)
vcsArgs.push('--recursive');
Expand Down