MercuryTechnologies / nix-your-shell

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

Broken pipe when running with nix run #4

Closed IGI-111 closed 1 year ago

IGI-111 commented 1 year ago

I get the following error log:

$ RUST_BACKTRACE=1 nix run github:MercuryTechnologies/nix-your-shell -- zsh | source
source: not enough arguments
The application panicked (crashed).
Message:  failed printing to stdout: Broken pipe (os error 32)
Location: library/std/src/io/stdio.rs:1009

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                ⋮ 7 frames hidden ⋮
   8: std::io::stdio::_print::h8161ac4f19406cdf
      at <unknown source file>:<unknown line>
   9: nix_your_shell::main::h1ef7ab779e977552
      at <unknown source file>:<unknown line>
  10: std::sys_common::backtrace::__rust_begin_short_backtrace::h50a6c336720655bd
      at <unknown source file>:<unknown line>
  11: std::rt::lang_start::{{closure}}::h4580b04423cddd21
      at <unknown source file>:<unknown line>
  12: std::rt::lang_start_internal::h398023bd7970a80b
      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_alias_1<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.
Run with RUST_BACKTRACE=full to include source snippets.

This also happens with fish.

9999years commented 1 year ago

Okay two issues here:

  1. Turns out you need nix-your-shell zsh | source /dev/stdin for it to read correctly (that's the broken pipe error)
  2. Turns out nix-your-shell zsh was printing the fish code instead of the zsh code

Both fixed in #5

9999years commented 1 year ago

Note you may need to do nix run --option tarball-ttl 0 ... to pick up the new source. Let me know if you have any other issues.