Skip to content

Commit c99579a

Browse files
fix message formatting
1 parent 11aa73c commit c99579a

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

logs.txt

Whitespace-only changes.

test/integration/node-specific/resource_tracking_script_builder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ export async function runScriptAndGetProcessInfo(
184184
// make sure the process ended
185185
const [exitCode] = await willClose;
186186

187-
const formattedLogRead = '{' + fs.readFileSync(logFile, 'utf-8').slice(0, -3) + '}';
188-
const messages = JSON.parse(formattedLogRead);
187+
// format messages from child process as an object
188+
const messages = (await readFile(logFile, 'utf-8')).trim().split('\n').map(line => JSON.parse(line)).reduce((acc, curr) => ({ ...acc, ...curr }), {});
189189

190190
// delete temporary files
191191
await unlink(scriptName);

test/tools/fixtures/process_resource_script.in.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function getNewLibuvResourceArray() {
3636

3737
function log(message) {
3838
// remove outer parentheses for easier parsing
39-
const messageToLog = JSON.stringify(message).slice(1, -1) + ', \n';
39+
const messageToLog = JSON.stringify(message) + ' \n';
4040
fs.writeFileSync(logFile, messageToLog, { flag: 'a' });
4141
}
4242

0 commit comments

Comments
 (0)