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

Zero results panic keybinds #276

Closed
Korkman opened this issue Feb 27, 2020 · 0 comments
Closed

Zero results panic keybinds #276

Korkman opened this issue Feb 27, 2020 · 0 comments
Labels

Comments

@Korkman
Copy link

Korkman commented Feb 27, 2020

Tested in 0.8.0, minimum example:

echo -n "" | RUST_BACKTRACE=1 sk --bind 'enter:execute(less)'

Pressing enter gives:

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libcore/macros/mod.rs:15:40
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/git.luolix.top-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/git.luolix.top-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:84
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:61
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1025
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1426
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:65
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:50
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:193
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:210
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:471
  11: rust_begin_unwind
             at src/libstd/panicking.rs:375
  12: core::panicking::panic_fmt
             at src/libcore/panicking.rs:84
  13: core::panicking::panic
             at src/libcore/panicking.rs:51
  14: skim::model::Model::act_execute_silent
  15: skim::model::Model::start
  16: skim::Skim::run_with
  17: sk::real_main
  18: sk::main
  19: std::rt::lang_start::{{closure}}
  20: main
  21: __libc_start_main
  22: _start

My thoughts:

  • For execute() with expanded braces {1}, cancel bind execution or exit with error.
  • Offering a command "if-none-selected()" would be great.
  • For binds with no expansion, they should be executed normally.
@lotabout lotabout added the bug label Feb 28, 2020
lotabout added a commit that referenced this issue Mar 1, 2020
- the action will be executed if the current matched item is `0`
- Note that even if the reader or matched is not completed yet, the
  action would still be executed if the current matched item is `0`
lotabout added a commit that referenced this issue Mar 1, 2020
Fix #276: execute panic on zero results
makovich pushed a commit to makovich/skim that referenced this issue May 28, 2020
- If the command refers to items, it is forbidden on zero results
- otherwise the command is allowed to execute all the time
makovich pushed a commit to makovich/skim that referenced this issue May 28, 2020
- the action will be executed if the current matched item is `0`
- Note that even if the reader or matched is not completed yet, the
  action would still be executed if the current matched item is `0`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants