Merge pull request #9513 from webpack/bugfix/terminal-length

make status logging 1 char shorter
This commit is contained in:
Tobias Koppers 2019-08-02 14:34:41 +02:00 committed by GitHub
commit 1d98daddab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -40,7 +40,9 @@ const clearStatusMessage = () => {
const writeStatusMessage = () => {
if (!currentStatusMessage) return;
const l = process.stderr.columns;
const args = l ? truncateArgs(currentStatusMessage, l) : currentStatusMessage;
const args = l
? truncateArgs(currentStatusMessage, l - 1)
: currentStatusMessage;
const str = args.join(" ");
const coloredStr = `\u001b[1m${str}\u001b[39m\u001b[22m`;
process.stderr.write(`\x1b[2K\r${coloredStr}`);

View File

@ -29,7 +29,7 @@ describe("ProgressPlugin", function() {
it("should not print lines longer than stderr.columns", () => {
const compiler = createSimpleCompiler();
process.stderr.columns = 30;
process.stderr.columns = 31;
return RunCompilerAsync(compiler).then(() => {
const logs = getLogs(stderr.toString());