Skip to content

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

Merged
sholderbach merged 2 commits into
nushell:mainfrom
WindSoilder:no_panic_when_parent_not_exists
Jun 3, 2022
Merged

sholderbach merged 2 commits into
nushell:mainfrom
WindSoilder:no_panic_when_parent_not_exists

Conversation

@WindSoilder

Copy link
Copy Markdown
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.

@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.

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

Comment thread src/history/file_backed.rs Resolved
Co-authored-by: Stefan Holderbach <[email protected]>
@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