Skip to content

Commit 55d13eb

Browse files
authored
fix(cli): file protocol check (#1064)
1 parent d969840 commit 55d13eb

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/cli.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export async function main() {
131131
await scriptFromHttp(firstArg, argv.ext)
132132
return
133133
}
134-
const filepath = firstArg.startsWith('file:///')
134+
const filepath = firstArg.startsWith('file://')
135135
? url.fileURLToPath(firstArg)
136136
: path.resolve(firstArg)
137137
await importPath(filepath)

src/repl.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ import { inspect } from 'node:util'
1919
import { ProcessOutput, defaults } from './core.js'
2020
import { chalk } from './vendor-core.js'
2121

22-
export async function startRepl() {
22+
const HISTORY = path.join(os.homedir(), '.zx_repl_history')
23+
24+
export async function startRepl(history = HISTORY) {
2325
defaults.verbose = false
2426
const r = repl.start({
2527
prompt: chalk.greenBright.bold('❯ '),
@@ -32,5 +34,5 @@ export async function startRepl() {
3234
return inspect(output, { colors: true })
3335
},
3436
})
35-
r.setupHistory(path.join(os.homedir(), '.zx_repl_history'), () => {})
37+
r.setupHistory(history, () => {})
3638
}

0 commit comments

Comments
 (0)