mirror of
https://github.com/oven-sh/bun
synced 2026-02-17 06:12:08 +00:00
maybe?
This commit is contained in:
@@ -3499,6 +3499,7 @@ pub fn selfExePath() ![:0]u8 {
|
||||
return memo.load();
|
||||
}
|
||||
pub const exe_suffix = if (Environment.isWindows) ".exe" else "";
|
||||
pub var is_standalone: ?bool = null;
|
||||
|
||||
pub const spawnSync = @This().spawn.sync.spawn;
|
||||
|
||||
|
||||
@@ -1766,6 +1766,8 @@ pub const Command = struct {
|
||||
|
||||
// bun build --compile entry point
|
||||
if (try bun.StandaloneModuleGraph.fromExecutable(bun.default_allocator)) |graph| {
|
||||
bun.is_standalone = true;
|
||||
|
||||
context_data = .{
|
||||
.args = std.mem.zeroes(Api.TransformOptions),
|
||||
.log = log,
|
||||
|
||||
@@ -4827,15 +4827,15 @@ pub const Interpreter = struct {
|
||||
defer bun.PathBufferPool.put(path_buf);
|
||||
const resolved = blk: {
|
||||
if (bun.strings.eqlComptime(first_arg_real, "bun") or bun.strings.eqlComptime(first_arg_real, "bun-debug")) blk2: {
|
||||
spawn_args.env_array.append(arena_allocator, "BUN_SKIP_STANDALONE_MODULE_GRAPH=1") catch break :blk2;
|
||||
if (bun.is_standalone == true) spawn_args.env_array.append(arena_allocator, "BUN_SKIP_STANDALONE_MODULE_GRAPH=1") catch break :blk2;
|
||||
break :blk bun.selfExePath() catch break :blk2;
|
||||
}
|
||||
|
||||
// if (bun.strings.eqlComptime(first_arg_real, "bunx")) blk2: {
|
||||
// spawn_args.env_array.append(arena_allocator, "BUN_SKIP_STANDALONE_MODULE_GRAPH=1") catch break :blk2;
|
||||
// this.args.insert(1, "x") catch bun.outOfMemory();
|
||||
// break :blk bun.selfExePath() catch break :blk2;
|
||||
// }
|
||||
if (bun.strings.eqlComptime(first_arg_real, "bunx")) blk2: {
|
||||
if (bun.is_standalone == true) spawn_args.env_array.append(arena_allocator, "BUN_SKIP_STANDALONE_MODULE_GRAPH=1") catch break :blk2;
|
||||
this.args.insert(1, "x") catch break :blk2;
|
||||
break :blk bun.selfExePath() catch break :blk2;
|
||||
}
|
||||
|
||||
break :blk which(path_buf, spawn_args.PATH, spawn_args.cwd, first_arg_real) orelse {
|
||||
this.writeFailingError("bun: command not found: {s}\n", .{first_arg});
|
||||
|
||||
@@ -105,9 +105,8 @@ describe("bun build", () => {
|
||||
expect(exitCode2).toBe(0);
|
||||
|
||||
// bunx
|
||||
// Bun.$``.nothrow
|
||||
const srcX = path.join(tmp, "indexx.js");
|
||||
fs.writeFileSync(srcX, 'console.log(await Bun.$`bunx cowsay hi`.text());', {
|
||||
fs.writeFileSync(srcX, "console.log(await Bun.$`bunx cowsay hi`.text());", {
|
||||
encoding: "utf8",
|
||||
});
|
||||
const outfileX = path.join(tmp, "indexx.exe");
|
||||
|
||||
Reference in New Issue
Block a user