diff --git a/src/cli.ts b/src/cli.ts index 00c672b55b..4e87711ede 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -26,7 +26,6 @@ import { minimist, fs, } from './index.js' -import { startRepl } from './repl.js' import { randomId } from './util.js' import { installDeps, parseDeps } from './deps.js' @@ -77,7 +76,7 @@ await (async function main() { return } if (argv.repl) { - startRepl() + await (await import('./repl.js')).startRepl() return } if (argv.eval) { diff --git a/src/core.ts b/src/core.ts index 908ac4c015..28131d9b41 100644 --- a/src/core.ts +++ b/src/core.ts @@ -84,8 +84,12 @@ try { defaults.quote = quote } catch (err) { if (process.platform == 'win32') { - defaults.shell = which.sync('powershell.exe') - defaults.quote = quotePowerShell + try { + defaults.shell = which.sync('powershell.exe') + defaults.quote = quotePowerShell + } catch (err) { + // no powershell? + } } } diff --git a/src/repl.ts b/src/repl.ts index 3ad6f57450..ea6d8f68ec 100644 --- a/src/repl.ts +++ b/src/repl.ts @@ -14,14 +14,13 @@ import os from 'node:os' import path from 'node:path' -import repl from 'node:repl' import { inspect } from 'node:util' import { ProcessOutput, defaults } from './core.js' import { chalk } from './vendor.js' -export function startRepl() { +export async function startRepl() { defaults.verbose = false - const r = repl.start({ + const r = (await import('node:repl')).start({ prompt: chalk.greenBright.bold('❯ '), useGlobal: true, preview: false,