Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix unicode problems with verbose log #1165

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/verbose/log.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import process from 'node:process';
import {writeFileSync} from 'node:fs';
import {inspect} from 'node:util';
import {escapeLines} from '../arguments/escape.js';
Expand All @@ -9,6 +10,13 @@
const verboseObject = getVerboseObject({type, result, verboseInfo});
const printedLines = getPrintedLines(verboseMessage, verboseObject);
const finalLines = applyVerboseOnLines(printedLines, verboseInfo, fdNumber);
// On Windows when stdout is pointing to a terminal writeFileSync causes problems with multibyte Characters not displaying correctly
// When stderr is pointing to console, the write command is allway behaving synchronously
if (process.platform === 'win32' && process.stderr.isTTY) {
process.stderr.write(finalLines);
return;
}

Check warning on line 18 in lib/verbose/log.js

View check run for this annotation

Codecov / codecov/patch

lib/verbose/log.js#L16-L18

Added lines #L16 - L18 were not covered by tests

writeFileSync(STDERR_FD, finalLines);
};

Expand Down