diff --git a/src/cli/repl_command.zig b/src/cli/repl_command.zig index ef84b82ae6..086b478ab1 100644 --- a/src/cli/repl_command.zig +++ b/src/cli/repl_command.zig @@ -9,7 +9,10 @@ pub const ReplCommand = struct { const temp_dir = bun.fs.FileSystem.RealFS.platformTempDir(); // Create unique temp file name with PID to avoid collisions - const pid = std.os.linux.getpid(); + const pid = if (bun.Environment.isWindows) + std.os.windows.GetCurrentProcessId() + else + std.c.getpid(); var temp_path_buf: [bun.MAX_PATH_BYTES]u8 = undefined; const temp_path = std.fmt.bufPrint(&temp_path_buf, "{s}/bun-repl-{d}.ts", .{ temp_dir, pid }) catch { Output.prettyErrorln("error: Could not create temp path", .{}); diff --git a/src/js/eval/repl.ts b/src/js/eval/repl.ts index 9ed2647a3c..a5297529d2 100644 --- a/src/js/eval/repl.ts +++ b/src/js/eval/repl.ts @@ -192,7 +192,9 @@ const replCommands: Record voi return; } try { - const code = fs.readFileSync(filename.trim(), "utf-8"); + // Resolve relative paths against the user's current working directory + const resolvedPath = path.resolve(process.cwd(), filename.trim()); + const code = fs.readFileSync(resolvedPath, "utf-8"); const result = evaluateCode(code); if (result !== undefined) { console.log(formatResult(result)); diff --git a/test/cli/install/bun-repl.test.ts b/test/cli/install/bun-repl.test.ts deleted file mode 100644 index a1fdc65161..0000000000 --- a/test/cli/install/bun-repl.test.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Tests for `bun repl` functionality are in test/regression/issue/26058.test.ts -// This file is kept for backwards compatibility but the main tests are in the regression folder - -import { describe, test } from "bun:test"; - -describe("bun repl", () => { - test.skip("moved to test/regression/issue/26058.test.ts", () => { - // REPL tests have been consolidated in the regression test file - }); -});