Skip to content

Commit

Permalink
TT
Browse files Browse the repository at this point in the history
  • Loading branch information
IIIMADDINIII committed Oct 27, 2024
1 parent d00cdb2 commit 8754791
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/verbose/log.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import process from 'node:process';
import {writeFileSync} from 'node:fs';
import {inspect} from 'node:util';
import {escapeLines} from '../arguments/escape.js';
import {defaultVerboseFunction} from './default.js';
import {applyVerboseOnLines} from './custom.js';
import { writeFileSync } from 'node:fs';

Check failure on line 2 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on macos

There should be no space after '{'.

Check failure on line 2 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on macos

There should be no space before '}'.

Check failure on line 2 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on ubuntu

There should be no space after '{'.

Check failure on line 2 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on ubuntu

There should be no space before '}'.

Check failure on line 2 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on macos

There should be no space after '{'.

Check failure on line 2 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on macos

There should be no space before '}'.

Check failure on line 2 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on ubuntu

There should be no space after '{'.

Check failure on line 2 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on ubuntu

There should be no space before '}'.

Check failure on line 2 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on windows

There should be no space after '{'.

Check failure on line 2 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on windows

There should be no space before '}'.

Check failure on line 2 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on windows

There should be no space after '{'.

Check failure on line 2 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on windows

There should be no space before '}'.
import { inspect } from 'node:util';

Check failure on line 3 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on macos

There should be no space after '{'.

Check failure on line 3 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on macos

There should be no space before '}'.

Check failure on line 3 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on ubuntu

There should be no space after '{'.

Check failure on line 3 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on ubuntu

There should be no space before '}'.

Check failure on line 3 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on macos

There should be no space after '{'.

Check failure on line 3 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on macos

There should be no space before '}'.

Check failure on line 3 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on ubuntu

There should be no space after '{'.

Check failure on line 3 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on ubuntu

There should be no space before '}'.

Check failure on line 3 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on windows

There should be no space after '{'.

Check failure on line 3 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on windows

There should be no space before '}'.

Check failure on line 3 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on windows

There should be no space after '{'.

Check failure on line 3 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on windows

There should be no space before '}'.
import { escapeLines } from '../arguments/escape.js';

Check failure on line 4 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on macos

There should be no space after '{'.

Check failure on line 4 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on macos

There should be no space before '}'.

Check failure on line 4 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on ubuntu

There should be no space after '{'.

Check failure on line 4 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on ubuntu

There should be no space before '}'.

Check failure on line 4 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on macos

There should be no space after '{'.

Check failure on line 4 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on macos

There should be no space before '}'.

Check failure on line 4 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on ubuntu

There should be no space after '{'.

Check failure on line 4 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on ubuntu

There should be no space before '}'.

Check failure on line 4 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on windows

There should be no space after '{'.

Check failure on line 4 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on windows

There should be no space before '}'.

Check failure on line 4 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on windows

There should be no space after '{'.

Check failure on line 4 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on windows

There should be no space before '}'.
import { defaultVerboseFunction } from './default.js';

Check failure on line 5 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on macos

There should be no space after '{'.

Check failure on line 5 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on macos

There should be no space before '}'.

Check failure on line 5 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on ubuntu

There should be no space after '{'.

Check failure on line 5 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on ubuntu

There should be no space before '}'.

Check failure on line 5 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on macos

There should be no space after '{'.

Check failure on line 5 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on macos

There should be no space before '}'.

Check failure on line 5 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on ubuntu

There should be no space after '{'.

Check failure on line 5 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on ubuntu

There should be no space before '}'.

Check failure on line 5 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on windows

There should be no space after '{'.

Check failure on line 5 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on windows

There should be no space before '}'.

Check failure on line 5 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on windows

There should be no space after '{'.

Check failure on line 5 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on windows

There should be no space before '}'.
import { applyVerboseOnLines } from './custom.js';

Check failure on line 6 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on macos

There should be no space after '{'.

Check failure on line 6 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on macos

There should be no space before '}'.

Check failure on line 6 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on ubuntu

There should be no space after '{'.

Check failure on line 6 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on ubuntu

There should be no space before '}'.

Check failure on line 6 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on macos

There should be no space after '{'.

Check failure on line 6 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on macos

There should be no space before '}'.

Check failure on line 6 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on ubuntu

There should be no space after '{'.

Check failure on line 6 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on ubuntu

There should be no space before '}'.

Check failure on line 6 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on windows

There should be no space after '{'.

Check failure on line 6 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 22 on windows

There should be no space before '}'.

Check failure on line 6 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on windows

There should be no space after '{'.

Check failure on line 6 in lib/verbose/log.js

View workflow job for this annotation

GitHub Actions / Node.js 18 on windows

There should be no space before '}'.

// Write synchronously to ensure lines are properly ordered and not interleaved with `stdout`
export const verboseLog = ({type, verboseMessage, fdNumber, verboseInfo, result}) => {
const verboseObject = getVerboseObject({type, result, verboseInfo});
export const verboseLog = ({ type, verboseMessage, fdNumber, verboseInfo, result }) => {
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) {
if (process.platform === 'win32' && process.stderr.isTTY) {
process.stderr.write(finalLines);
return;
}
Expand All @@ -22,7 +22,7 @@ export const verboseLog = ({type, verboseMessage, fdNumber, verboseInfo, result}
const getVerboseObject = ({
type,
result,
verboseInfo: {escapedCommand, commandId, rawOptions: {piped = false, ...options}},
verboseInfo: { escapedCommand, commandId, rawOptions: { piped = false, ...options } },
}) => ({
type,
escapedCommand,
Expand All @@ -35,11 +35,11 @@ const getVerboseObject = ({

const getPrintedLines = (verboseMessage, verboseObject) => verboseMessage
.split('\n')
.map(message => getPrintedLine({...verboseObject, message}));
.map(message => getPrintedLine({ ...verboseObject, message }));

const getPrintedLine = verboseObject => {
const verboseLine = defaultVerboseFunction(verboseObject);
return {verboseLine, verboseObject};
return { verboseLine, verboseObject };
};

// Unless a `verbose` function is used, print all logs on `stderr`
Expand Down

0 comments on commit 8754791

Please sign in to comment.