Skip to content

Commit

Permalink
fix(cli): Ensure newline to prevent error output boxen misalignment (#…
Browse files Browse the repository at this point in the history
…9135)

**Problem**
When invoking a ctrl+c the boxen error output is misaligned.

**Fix**
Just print a newline before the boxen encased error output.

**Future**
@dac09 - This at least solves the misalignment. It doesn't address the
issue with the error showing when it's not really appropriate. I think
that might be more appropriately dealt with by directly try-catching the
execa call where it is called.

I have tried on all three platforms:
* Windows - I get `Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs
with a scheme in: file, data, and node are supported by the default ESM
loader. On Windows, absolute paths must be valid file:// URLs. Received
protocol 'e:'` so I can't really debug further until I address that.
* Ubuntu - I don't get any error output shown but the process does exit
with an error code 129.
* Mac - I just got a MacBook so I can now test this case - even though I
feel like a child because I have no idea of to use a mac effectively
yet. I do get the error output but I got an exit code 1.
I'll take a further attempt at debugging this cross platform exit code
stuff when I'm a little more familiar with mac. One thing to note is
that @jtoar and I already had a similar issue where execa/storybook
itself behaved differently on mac, windows & ubuntu so we might be a
little at the whims of our dependencies with this.

TLDR - Boxen output fixed. Excessive error output I'll fix in a future
PR because it'll be a more carefully thought out change.
  • Loading branch information
Josh-Walker-GM authored and thedavidprice committed Sep 8, 2023
1 parent 6e815a0 commit d584fd8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/cli/src/lib/exit.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export function exitWithError(
.filter(Boolean)
.join('\n')

console.error()
console.error(
boxen(content, {
padding: 1,
Expand Down

0 comments on commit d584fd8

Please sign in to comment.