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

Don't panic when parent directory does not exist #436

Merged

Conversation

WindSoilder
Copy link
Contributor

Relative: nushell/nushell#5203

After investigate, I think nu will crash is because history file's parent is deleted, and it leads to file sync operation failed.

Refer to the expected behavior in that issue:

I expected nu to ask to recreate the missing config files, like it did on first start.

I think that's too complicated to implement such feature, instead, we can make nu work as normal (because config is loaded to memory), we just need to create that missing directory.

Copy link
Member

@sholderbach sholderbach left a comment

Choose a reason for hiding this comment

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

Good catch. Yeah that was making assumptions that the file would always exist after creation of the history.

src/history/file_backed.rs Outdated Show resolved Hide resolved
Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>
@sholderbach sholderbach changed the title don't panic whan parent directory is not exists Don't panic when parent directory does not exist Jun 3, 2022
@sholderbach sholderbach merged commit 59379bf into nushell:main Jun 3, 2022
@WindSoilder WindSoilder deleted the no_panic_when_parent_not_exists branch June 3, 2022 09:57
sholderbach added a commit to nushell/nushell that referenced this pull request Jun 3, 2022
Resolves an unexpected issue due to `Deref` and `ToString` interacting

Details: nushell/nu-ansi-term#5 and nushell/reedline#435 (comment)

Also updates reedline: Includes a fix for a panic when the directory containing the history is deleted during a running reedline session. (nushell/reedline#436)
fennewald pushed a commit to fennewald/nushell that referenced this pull request Jun 27, 2022
Resolves an unexpected issue due to `Deref` and `ToString` interacting

Details: nushell/nu-ansi-term#5 and nushell/reedline#435 (comment)

Also updates reedline: Includes a fix for a panic when the directory containing the history is deleted during a running reedline session. (nushell/reedline#436)
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.

2 participants