Skip to content

Fix save error handling - #7608

Merged
sholderbach merged 11 commits into
nushell:mainfrom
NotLebedev:save-errors-fix
Jan 3, 2023
Merged

sholderbach merged 11 commits into
nushell:mainfrom
NotLebedev:save-errors-fix

Conversation

@NotLebedev

Copy link
Copy Markdown
Contributor

Description

  • Fixes a pipeline with | save at the end does not report errors #5178

  • Fixes save command wiping file when saving to structured format and conversion fails.
    Before:

    image

    After:

    image

  • Fixes save not applying --append and --force correctly to stderr output file. See new tests: save_append_works_on_stderr, save_not_overrides_err_by_default and save_override_works_stderr.

  • Refactoring and documentation.

User-Facing Changes

  • --force and --append now affect stderr file.

Tests + Formatting

Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

  • cargo fmt --all -- --check to check standard code formatting (cargo fmt --all applies these changes)
  • cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect to check that you're using the standard code style
  • cargo test --workspace to check that all tests pass

After Submitting

If your PR had any user-facing changes, update the documentation after the PR is merged, if necessary. This will help us keep the docs up to date.

@sholderbach sholderbach left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking a crack at it! Looks much better without that much spaghetti code!
Your tests look fine as well. Have not checked out the details of the implementation yet but should get around to that soon (If I am not overtaken in that by someone more familiar with save's details)

@WindSoilder

WindSoilder commented Jan 3, 2023 •

Copy link
Copy Markdown
Contributor

Thanks! It looks good to me, new implementation looks much better

@sholderbach

Copy link
Copy Markdown
Member

Thanks for the individual commits! Was very nice to review. Agree with @WindSoilder

@sholderbach sholderbach changed the title Save errors fix Fix save error handling Jan 3, 2023
@sholderbach
sholderbach merged commit 9e1f645 into nushell:main Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

a pipeline with | save at the end does not report errors

3 participants