Skip to content

Commit 8a7e919

Browse files
committed
Skip redacting URLs printed to console when browser not available
1 parent d389614 commit 8a7e919

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

lib/utils/display.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,11 @@ class Display {
259259
// Write formatted and (non-)colorized output to streams
260260
#write (stream, options, ...args) {
261261
const colors = stream === this.#stdout ? this.#stdoutColor : this.#stderrColor
262-
const value = formatWithOptions({ colors, ...options }, ...args)
262+
const skipRedact = args.length > 0 ? args[args.length - 1]?.skipRedact : false
263+
if (skipRedact) {
264+
args = args.slice(0, args.length - 1)
265+
}
266+
const value = formatWithOptions({ colors, ...options, skipRedact }, ...args)
263267
this.#progress.write(() => stream.write(value))
264268
}
265269

lib/utils/format.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,12 @@ function STRIP_C01 (str) {
4141
return result
4242
}
4343

44-
const formatWithOptions = ({ prefix: prefixes = [], eol = '\n', ...options }, ...args) => {
44+
const formatWithOptions = ({ prefix: prefixes = [], eol = '\n', skipRedact = false, ...options }, ...args) => {
4545
const prefix = prefixes.filter(p => p != null).join(' ')
46-
const formatted = redactLog(STRIP_C01(baseFormatWithOptions(options, ...args)))
46+
let formatted = STRIP_C01(baseFormatWithOptions(options, ...args))
47+
if (!skipRedact) {
48+
formatted = redactLog(formatted)
49+
}
4750
// Splitting could be changed to only `\n` once we are sure we only emit unix newlines.
4851
// The eol param to this function will put the correct newlines in place for the returned string.
4952
const lines = formatted.split(/\r?\n/)

lib/utils/open-url.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ const assertValidUrl = (url) => {
1616

1717
const outputMsg = (json, title, url) => {
1818
if (json) {
19-
output.buffer({ title, url })
19+
output.buffer({ title, url }, { skipRedact: true })
2020
} else {
21-
output.standard(`${title}:\n${url}`)
21+
output.standard(`${title}:\n${url}`, { skipRedact: true })
2222
}
2323
}
2424

0 commit comments

Comments
 (0)