WIP Make process.stdout sync on windows (#9398)

* Make some things sync on windows

* WIP

* WIP

* remove uses to uv_default_loop

* remove a compiler warning on windows

* edfghjk

* Windows build fixes

* Fixup

* bundows

* Add quotes

* Fix --cwd arg on Windows

* comment

* move this up

* Fix some tests

* `mv` tests pass

* spawn.test passes again

* Allow .sh file extension for Windows

* Unmark failing tests

* env test pass

* windows

* Fix some tests

* Update ProcessBindingTTYWrap.cpp

* Update CMakeLists.txt

* Set tmpdir

* Make it 5s on windows

* Fixup

* Fixup

* Update ProcessBindingTTYWrap.cpp

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: dave caruso <me@paperdave.net>
This commit is contained in:
Jarred Sumner
2024-03-18 19:35:34 -07:00
committed by GitHub
parent e1593ce2e5
commit 76ced7c6ed
46 changed files with 669 additions and 267 deletions

View File

@@ -408,10 +408,21 @@ pub const Arguments = struct {
if (args.option("--cwd")) |cwd_| {
cwd = brk: {
var outbuf: [bun.MAX_PATH_BYTES]u8 = undefined;
const out = std.os.realpath(cwd_, &outbuf) catch |err| {
Output.prettyErrorln("error resolving --cwd: {s}", .{@errorName(err)});
Global.exit(1);
};
const out = bun.path.joinAbs(try bun.getcwd(&outbuf), .loose, cwd_);
// On POSIX, we don't actually call chdir() on the path
//
// On Windows, we do change the current directory.
// Not all system calls on Windows support passing a dirfd (and libuv entirely doesn't)
// So we have to do it the real way
if (comptime Environment.isWindows) {
var wbuf: bun.WPathBuffer = undefined;
bun.sys.chdir(bun.strings.toWPathNormalized(&wbuf, out)).unwrap() catch |err| {
Output.prettyErrorln("{}\n", .{err});
Global.exit(1);
};
}
break :brk try allocator.dupe(u8, out);
};
} else {