MercuryTechnologies / nix-your-shell

A `nix` and `nix-shell` wrapper for shells other than `bash`
MIT License
85 stars 12 forks source link

`nix-your-shell fish | source` leads to crash #49

Closed Cameo007 closed 6 months ago

Cameo007 commented 6 months ago
[nix-shell:~]$ nix-your-shell fish | source
bash: source: Ein Dateiname wird als Argument benötigt.
source: Aufruf: source Dateiname [Argumente]
The application panicked (crashed).
Message:  failed printing to stdout: Broken pipe (os error 32)
Location: library/std/src/io/stdio.rs:1019

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Here with the full backtrace

[nix-shell:~]$ RUST_BACKTRACE=full nix-your-shell fish | source
bash: source: Ein Dateiname wird als Argument benötigt.
source: Aufruf: source Dateiname [Argumente]
The application panicked (crashed).
Message:  failed printing to stdout: Broken pipe (os error 32)
Location: library/std/src/io/stdio.rs:1019

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                ⋮ 7 frames hidden ⋮                               
   8: std::io::stdio::_print::h0bcdd912d127d2b4
      at <unknown source file>:<unknown line>
   9: nix_your_shell::main::h15a21ab7558f2542
      at <unknown source file>:<unknown line>
  10: std::sys_common::backtrace::__rust_begin_short_backtrace::hf68bfca063659b6f
      at <unknown source file>:<unknown line>
  11: std::rt::lang_start::{{closure}}::h323446e6e0ffbd2f
      at <unknown source file>:<unknown line>
  12: std::rt::lang_start_internal::h691452d5fd9810c0
      at <unknown source file>:<unknown line>
  13: main<unknown>
      at <unknown source file>:<unknown line>
  14: __libc_start_call_main<unknown>
      at <unknown source file>:<unknown line>
  15: __libc_start_main_impl<unknown>
      at <unknown source file>:<unknown line>
  16: _start<unknown>
      at <unknown source file>:<unknown line>

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
9999years commented 6 months ago

What's going on here is you're asking bash to source fish code (which it cannot do), bash realizes this and closes the nix-your-shell stdout pipe, and then the next nix-your-shell print fails.

It shouldn't crash, but this also won't work after I fix the crash.