Skip to content

fix history clear crash - #9575

Closed
amtoine wants to merge 4 commits into
nushell:mainfrom
amtoine:fix-history-clear-crash
Closed

amtoine wants to merge 4 commits into
nushell:mainfrom
amtoine:fix-history-clear-crash

Conversation

@amtoine

@amtoine amtoine commented Jun 30, 2023

Copy link
Copy Markdown
Member

should close #7991

Description

User-Facing Changes

history --clear should not crash the shell now with the SQLITE history.

Tests + Formatting

  • 🟢 toolkit fmt
  • 🟢 toolkit clippy
  • ⚫ toolkit test
  • ⚫ toolkit test stdlib

After Submitting

$nothing

amtoine added 4 commits June 30, 2023 19:34
this commit uses
```
if some_guard_condition {
    // do something
    return ...;
}

// do some other thing
```
instead of
```
if some_guard_condition {
    // do something
    ...
} else {
    // do some other thing
}
```
Comment thread crates/nu-cli/src/commands/history.rs Resolved
@amtoine

amtoine commented Jul 2, 2023

Copy link
Copy Markdown
Member Author

@fdncred @andrasio
are we good to land this? 😇

it looks to me the thread about windows is unrelated to this PR 😋

@andrasio

andrasio commented Jul 2, 2023

Copy link
Copy Markdown
Member

@fdncred @andrasio are we good to land this? 😇

it looks to me the thread about windows is unrelated to this PR 😋

Agree.

@fdncred

fdncred commented Jul 2, 2023

Copy link
Copy Markdown
Contributor

it looks to me the thread about windows is unrelated to this PR 😋

How would this be unrelated? This PR is introducing a feature that may fail in windows. We don't know because we are ignoring errors and might be silently failing, right?

@sholderbach

Copy link
Copy Markdown
Member

I have trust in you guys to come to a solution.
My only comment would be: Should this be a reedline level change instead of a nushell change?

@amtoine

amtoine commented Jul 3, 2023

Copy link
Copy Markdown
Member Author

How would this be unrelated? This PR is introducing a feature that may fail in windows. We don't know because we are ignoring errors and might be silently failing, right?

maybe the error handling method is not the correct one for windows but i've just borrowed the same let _ = some_function_with_io_error(...); structure, this is why i'm saying i think it's unrelated to the PR because this was done that way before 👍

not that it shouldn't be fixed (even as i said in the thread above, it looks fine to me because we do not care if there is an I/O error here imo) but just that it's not a new potential bug introduced in this PR 😌

@fdncred

fdncred commented Jul 3, 2023

Copy link
Copy Markdown
Contributor

If this PR is supposed to fix the problem when you do history --clear and nushell crashes, without regard to making history --clear work, that's fine. Fixing a crash is good. I just thought the intent was to make history --clear work cross-platform.

@amtoine

amtoine commented Jul 3, 2023

Copy link
Copy Markdown
Member Author

If this PR is supposed to fix the problem when you do history --clear and nushell crashes, without regard to making history --clear work, that's fine. Fixing a crash is good. I just thought the intent was to make history --clear work cross-platform.

ooh no no, this PR solely tries to solve #7991, i.e. the crash i noticed when using history --clear 😋
i've no idea if there is an issue with history --clear on windows 😱

@amtoine

amtoine commented Jul 12, 2023

Copy link
Copy Markdown
Member Author

can we land this PR? 😇

@fdncred

fdncred commented Aug 24, 2023

Copy link
Copy Markdown
Contributor

is there a way to add a cross-platform test to ensure this doesn't panic? Like add a few commands to the history and then run clear?

@amtoine

amtoine commented Sep 15, 2023 •

Copy link
Copy Markdown
Member Author

i do not have much time to work on this now, so i'll make this a draft 😌

@amtoine
amtoine marked this pull request as draft September 15, 2023 16:58
@brunerm99 brunerm99 mentioned this pull request Oct 21, 2023
1 of 6 tasks
@amtoine

amtoine commented Nov 20, 2023

Copy link
Copy Markdown
Member Author

might be superseded by #11049

@amtoine

amtoine commented Dec 14, 2023

Copy link
Copy Markdown
Member Author

i don't have time to work on this right now...
so i'll go ahead and close this, it will still be available in the list of my closed PRs 😌

@amtoine amtoine closed this Dec 14, 2023
@amtoine
amtoine deleted the fix-history-clear-crash branch December 14, 2023 17:25
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.

clearing the history breaks nushell

4 participants