Skip to content

Commit

Permalink
fix: Fix empty newlines being removed.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Sep 12, 2024
1 parent eb978e8 commit 460f7c8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

#### 🐞 Fixes

- Fixed an issue where empty lines were being trimmed while streaming task console output.

## 1.28.1

#### 🚀 Updates
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: legacy/cli/tests/run_node_test.rs
source: crates/cli/tests/run_node_test.rs
expression: assert.output()
---
▪▪▪▪ npm install
Expand All @@ -10,9 +10,11 @@ stderr
node:internal/process/promises:288
triggerUncaughtException(err, true /* fromPromise */);
^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "Oops".] {
code: 'ERR_UNHANDLED_REJECTION'
}

Node.js v18.0.0
Error: task_runner::run_failed

Expand Down
9 changes: 4 additions & 5 deletions crates/console/src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,11 @@ impl ConsoleBuffer {
pub fn write_line<T: AsRef<[u8]>>(&self, data: T) -> miette::Result<()> {
let data = data.as_ref();

if data.is_empty() {
return Ok(());
}

self.write_raw(|buffer| {
buffer.extend_from_slice(data);
if !data.is_empty() {
buffer.extend_from_slice(data);
}

buffer.push(b'\n');
})
}
Expand Down

0 comments on commit 460f7c8

Please sign in to comment.