Skip to content

Commit

Permalink
Revert "Use threads only for git processes on windows"
Browse files Browse the repository at this point in the history
This reverts commit b8c24a7.
  • Loading branch information
tobil4sk committed Aug 26, 2024
1 parent be2fff1 commit 471244d
Showing 1 changed file with 19 additions and 30 deletions.
49 changes: 19 additions & 30 deletions src/haxelib/api/Vcs.hx
Original file line number Diff line number Diff line change
Expand Up @@ -193,39 +193,28 @@ abstract class Vcs implements IVcs {
// just in case process hangs waiting for stdin
p.stdin.close();

final ret = if (Sys.systemName() == "Windows") {
final streamsLock = new sys.thread.Lock();
function readFrom(stream:haxe.io.Input, to:{value:String}) {
to.value = stream.readAll().toString();
streamsLock.release();
}
final streamsLock = new sys.thread.Lock();
function readFrom(stream:haxe.io.Input, to: {value: String}) {
to.value = stream.readAll().toString();
streamsLock.release();
}

final out = {value: ""};
final err = {value: ""};
Thread.create(readFrom.bind(p.stdout, out));
Thread.create(readFrom.bind(p.stderr, err));
final out = {value: ""};
final err = {value: ""};
Thread.create(readFrom.bind(p.stdout, out));
Thread.create(readFrom.bind(p.stderr, err));

final code = p.exitCode();
for (_ in 0...2) {
// wait until we finish reading from both streams
streamsLock.wait();
}
{
code: code,
out: out.value,
err: err.value
};
} else {
final out = p.stdout.readAll().toString();
final err = p.stderr.readAll().toString();
final code = p.exitCode();
{
code: code,
out: out,
err: err
};
};
final code = p.exitCode();
for (_ in 0...2) {
// wait until we finish reading from both streams
streamsLock.wait();
}

final ret = {
code: code,
out: out.value,
err: err.value
};
p.close();
return ret;
}
Expand Down

0 comments on commit 471244d

Please sign in to comment.