Skip to content
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

Copy link
Member

Choose a reason for hiding this comment

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

Neko has been patched so I have reapplied that original fix for all platforms. That should handle the stderr/stdout issue.

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