Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): Ensure newline to prevent error output boxen misalignment #9135

Merged
merged 1 commit into from
Sep 6, 2023

Conversation

Josh-Walker-GM
Copy link
Collaborator

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.

@Josh-Walker-GM Josh-Walker-GM added the release:fix This PR is a fix label Sep 5, 2023
@Josh-Walker-GM Josh-Walker-GM added this to the next-release-patch milestone Sep 5, 2023
@Josh-Walker-GM Josh-Walker-GM marked this pull request as ready for review September 5, 2023 23:25
Copy link
Collaborator

dac09 commented Sep 6, 2023

Hey Josh, the exit code you’re looking for is 130, probably a mac thing? It’s a valid code that should be ignored I think - wrapping all our Execa would be a big anti pattern imo.

You can try this on mac with any longer running command that uses execa - generate, migrate, setup, etc. and cancel it midway I think! You wont see it if listr pops up... it must be handling the error code for us.

@Josh-Walker-GM Josh-Walker-GM merged commit ba6df4d into main Sep 6, 2023
29 checks passed
@Josh-Walker-GM Josh-Walker-GM deleted the jgmw-cli/fix-error-output branch September 6, 2023 08:18
thedavidprice pushed a commit that referenced this pull request Sep 8, 2023
…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.
@thedavidprice thedavidprice modified the milestones: next-release, v6.2.0 Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:fix This PR is a fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants