diff --git a/src/goods.ts b/src/goods.ts index e66cd741d2..f46bf1fd0f 100644 --- a/src/goods.ts +++ b/src/goods.ts @@ -14,7 +14,6 @@ import assert from 'node:assert' import { createInterface } from 'node:readline' -import process from 'node:process' import { $, within, ProcessOutput } from './core.js' import { type Duration, @@ -25,10 +24,10 @@ import { toCamelCase, } from './util.js' import { - minimist, - nodeFetch, type RequestInfo, type RequestInit, + nodeFetch, + minimist, } from './vendor.js' export { default as path } from 'node:path' @@ -83,9 +82,7 @@ export function echo(pieces: TemplateStringsArray, ...args: any[]) { } function stringify(arg: ProcessOutput | any) { - return arg instanceof ProcessOutput - ? arg.toString().replace(/\n$/, '') - : `${arg}` + return arg instanceof ProcessOutput ? arg.toString().trimEnd() : `${arg}` } export async function question( diff --git a/src/repl.ts b/src/repl.ts index 4487218f28..e67c9204a3 100644 --- a/src/repl.ts +++ b/src/repl.ts @@ -30,7 +30,7 @@ export async function startRepl(history = HISTORY) { preview: false, writer(output: any) { return output instanceof ProcessOutput - ? output.toString().replace(/\n$/, '') + ? output.toString().trimEnd() : inspect(output, { colors: true }) }, })