jacek-kurlit / pik

Process Interactive Kill
https://crates.io/crates/pik
MIT License
186 stars 6 forks source link

Fix mac os #79

Closed jacek-kurlit closed 1 month ago

jacek-kurlit commented 1 month ago

For whatever reasons one integration test fails on mac during pipeline build. Also pik does not work currently on mac os (which it did) Try to figure out what is going on

--- STDERR:              pik::processes_search should_find_cargo_process_by_cmd_path ---
thread 'should_find_cargo_process_by_cmd_path' panicked at tests/processes_search.rs:18:5:
assertion failed: results.iter().all(|p| p.cmd_path.as_ref().expect("what?").contains("cargo"))
stack backtrace:
   0:        0x1024f6d28 - std::backtrace_rs::backtrace::libunwind::trace::hbebc8679d47bdc2c
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:        0x1024f6d28 - std::backtrace_rs::backtrace::trace_unsynchronized::h3a2e9637943241aa
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:        0x1024f6d28 - std::sys::backtrace::_print_fmt::he430849680584674
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/sys/backtrace.rs:65:5
   3:        0x1024f6d28 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h243268f17d714c7f
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/sys/backtrace.rs:40:26
   4:        0x1025138b0 - core::fmt::rt::Argument::fmt::h0d339881c25f3c31
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/fmt/rt.rs:173:76
   5:        0x1025138b0 - core::fmt::write::hb3cfb8a30e72d7ff
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/fmt/mod.rs:1182:21
   6:        0x1024f3cc8 - std::io::Write::write_fmt::hfb2314975de9ecf1
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/io/mod.rs:1827:15
   7:        0x1024f8250 - std::sys::backtrace::BacktraceLock::print::he14461129ccbfef5
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/sys/backtrace.rs:43:9
   8:        0x1024f8250 - std::panicking::default_hook::{{closure}}::h14c7718ccf39d316
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:269:22
   9:        0x1024f7e74 - std::panicking::default_hook::hc62e60da3be2f352
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:296:9
  10:        0x1024f8d14 - std::panicking::rust_panic_with_hook::h09e8a656f11e82b2
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:800:13
  11:        0x1024f863c - std::panicking::begin_panic_handler::{{closure}}::h1230eb3cc91b241c
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:667:13
  12:        0x1024f71b4 - std::sys::backtrace::__rust_end_short_backtrace::hc3491307aceda2c2
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/sys/backtrace.rs:168:18
  13:        0x1024f832c - rust_begin_unwind
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:665:5
  14:        0x102527c2c - core::panicking::panic_fmt::ha4b80a05b9fff47a
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:74:14
  15:        0x102527c98 - core::panicking::panic::h298549a7412a7069
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:148:5
  16:        0x1021eacdc - processes_search::should_find_cargo_process_by_cmd_path::h15df125469420b7a
                               at /Users/runner/work/pik/pik/tests/processes_search.rs:18:5
  17:        0x1021eab10 - processes_search::should_find_cargo_process_by_cmd_path::{{closure}}::h7dff8cf609adca08
                               at /Users/runner/work/pik/pik/tests/processes_search.rs:14:43
  18:        0x1021e9ac4 - core::ops::function::FnOnce::call_once::h0cda8e83f6e0c567
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ops/function.rs:250:5
  19:        0x10221b7dc - core::ops::function::FnOnce::call_once::h0ba6e3d0adcb0fb8
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ops/function.rs:250:5
  20:        0x10221b7dc - test::__rust_begin_short_backtrace::hc730144174a2f2b8
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/test/src/lib.rs:624:18
  21:        0x10221b130 - test::run_test_in_process::{{closure}}::h9e544e0587f41be2
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/test/src/lib.rs:647:60
  22:        0x10221b130 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h8389036b3da9abb4
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panic/unwind_safe.rs:272:9
  23:        0x10221b130 - std::panicking::try::do_call::h6c15d214f8b0efc9
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:557:40
  24:        0x10221b130 - std::panicking::try::h4dec6d151c5d7c52
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:521:19
  25:        0x10221b130 - std::panic::catch_unwind::h08246350d14b78e5
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panic.rs:350:14
  26:        0x10221b130 - test::run_test_in_process::h5176f0d7330017af
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/test/src/lib.rs:647:27
  27:        0x10221b130 - test::run_test::{{closure}}::h3dade545f948edf5
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/test/src/lib.rs:568:43
  28:        0x1021ed25c - test::run_test::{{closure}}::h331e167c3eb94f21
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/test/src/lib.rs:598:41
  29:        0x1021ed25c - std::sys::backtrace::__rust_begin_short_backtrace::h927c17d76a6dfbc6
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/sys/backtrace.rs:152:18
  30:        0x1021f03c0 - std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}::h9a08c487421e7042
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/thread/mod.rs:538:17
  31:        0x1021f03c0 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::hf6a2344f0bd24956
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panic/unwind_safe.rs:272:9
  32:        0x1021f03c0 - std::panicking::try::do_call::hfdb1a93845faf3ef
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:557:40
  33:        0x1021f03c0 - std::panicking::try::h4b35ce5ad8a162fd
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:521:19
  34:        0x1021f03c0 - std::panic::catch_unwind::h3bb4d3ee2986e761
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panic.rs:350:14
  35:        0x1021f03c0 - std::thread::Builder::spawn_unchecked_::{{closure}}::h5e36dd32c0d26255
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/thread/mod.rs:537:30
  36:        0x1021f03c0 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h4b1e8564c6e52dc1
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ops/function.rs:250:5
  37:        0x1024fc738 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h01276ebbe54a8110
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/boxed.rs:2070:9
  38:        0x1024fc738 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::habad1faa89d23086
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/boxed.rs:2070:9
  39:        0x1024fc738 - std::sys::pal::unix::thread::Thread::new::thread_start::h1bd1b9c95010bf71
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/sys/pal/unix/thread.rs:108:17
  40:        0x195fb5f94 - __pthread_joiner_wake
grouzen commented 1 month ago

Another thing I noticed when I was running pik on Mac is that the UI is completely broken. There are lots of artifacts around, the rows with green backgrounds randomly appear, etc. I believe the terminal settings are default in my case.

jacek-kurlit commented 1 month ago

Another thing I noticed when I was running pik on Mac is that the UI is completely broken. There are lots of artifacts around, the rows with green backgrounds randomly appear, etc. I believe the terminal settings are default in my case.

Ok this is wild because it was working on mac, I have tested it on my friend's laptop Maybe that fuzzy search somehow has broken pik? Did you try to to run pik without your change on Mac?

grouzen commented 1 month ago

Ah yeah, I forgot to mention this. It is broken without fuzzy search too.

jacek-kurlit commented 1 month ago

Ok then, mac os is unsupported until fixed

grouzen commented 1 month ago

Here, I'm running the version from the main branch.

This is how it looks after I launched it: photo_2024-09-27_11-13-07

The second screenshot is after I pressed down a couple of times (all rows became green): photo_2024-09-27_11-13-10

Sorry for my previous misleading comment, it is not entirely broken, just a bit in regard to coloring

jacek-kurlit commented 1 month ago

This needs to be fixed and since I don't own mac os I cannot assure working binaries for this system anyway.

grouzen commented 1 month ago

One of the options could be renting Mac instance in the cloud. Just saying :) Cheers!

grouzen commented 1 month ago

I was fiddling with https://kdash.cli.rs and found this line in their docs:

[macOS] KDash looks better on iTerm2 since macOS’s default Terminal app makes the colors render weird.

This is exactly what I see in my case (the terminal is a default one).

jacek-kurlit commented 1 month ago

I knew it was something with color rendering in terminal. Good to know thx!

jacek-kurlit commented 1 month ago

Fixed in https://github.com/jacek-kurlit/pik/issues/84