Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
core(console): add workaround for weird migration format
Browse files Browse the repository at this point in the history
  • Loading branch information
cds-amal committed Dec 14, 2022
1 parent 3123c7b commit f83cf2d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/core/lib/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const {
createInterfaceAdapter
} = require("@truffle/interface-adapter");
const contract = require("@truffle/contract");
const os = require("os");
const vm = require("vm");
const expect = require("@truffle/expect");
const TruffleError = require("@truffle/error");
Expand Down Expand Up @@ -347,8 +348,13 @@ class Console extends EventEmitter {
});

spawnedProcess.stdout.on("data", data => {
// remove extra newline in `truffle develop` console
console.log(data.toString().trim());
// convert buffer to string
data = data.toString();
// workaround: remove extra newline in `truffle develop` console
// truffle test, for some reason, appends a newline to the data
// it emits here.
if (data.endsWith(os.EOL)) data = data.slice(0, -os.EOL.length);
console.log(data);
});

return new Promise((resolve, reject) => {
Expand Down

0 comments on commit f83cf2d

Please sign in to comment.