mirror of
https://github.com/oven-sh/bun
synced 2026-02-11 11:29:02 +00:00
fix: which should use cwd if given a relative filepath (#9761)
* Revert "fix!: do not lookup cwd in which (#9691)"
This reverts commit 4869ebff24.
* fix which implementation to be more accurate
* t
* which tests windows
* [autofix.ci] apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1564,7 +1564,7 @@ pub const CreateCommand = struct {
|
||||
Output.flush();
|
||||
|
||||
if (create_options.open) {
|
||||
if (which(&bun_path_buf, PATH, "bun")) |bin| {
|
||||
if (which(&bun_path_buf, PATH, destination, "bun")) |bin| {
|
||||
var argv = [_]string{bun.asByteSlice(bin)};
|
||||
var child = std.ChildProcess.init(&argv, ctx.allocator);
|
||||
child.cwd = destination;
|
||||
@@ -2289,7 +2289,7 @@ const GitHandler = struct {
|
||||
// Time (mean ± σ): 306.7 ms ± 6.1 ms [User: 31.7 ms, System: 269.8 ms]
|
||||
// Range (min … max): 299.5 ms … 318.8 ms 10 runs
|
||||
|
||||
if (which(&bun_path_buf, PATH, "git")) |git| {
|
||||
if (which(&bun_path_buf, PATH, destination, "git")) |git| {
|
||||
const git_commands = .{
|
||||
&[_]string{ git, "init", "--quiet" },
|
||||
&[_]string{ git, "add", destination, "--ignore-errors" },
|
||||
|
||||
Reference in New Issue
Block a user