matchai / spacefish

πŸš€πŸŸ The fish shell prompt for astronauts
https://spacefish.matchai.dev
MIT License
963 stars 77 forks source link

Package version detection fails with error 'jq -r '.version' package.json' terminated by signal SIGABRT (Abort) #178

Closed tlpbu closed 5 years ago

tlpbu commented 5 years ago

Bug Report

Current Behavior Every shell command in directory containing package.json fails with error fish: Job 10, 'jq -r '.version' package.json 2…' terminated by signal SIGABRT (Abort)

Expected Behavior Package version properly detected without errors in console.

Relevant Fish Configuration

set -g fish_user_paths "/usr/local/sbin" $fish_user_paths
source ~/.asdf/asdf.fish
source (pyenv init - | psub)

set SPACEFISH_PROMPT_ORDER time user dir host git package node docker ruby pyenv kubecontext exec_time line_sep jobs exit_code char

alias k=kubectl

Environment

Possible Solution Omprove jq existance in if condition in /functions/F__sf_section_package.fish

Additional context/Screenshots

dyld: Library not loaded: /usr/local/opt/oniguruma/lib/libonig.4.dylib
  Referenced from: /usr/local/bin/jq
  Reason: image not found
fish: 'jq -r '.version' package.json' terminated by signal SIGABRT (Abort)
fish: Job 10, 'jq -r '.version' package.json 2…' terminated by signal SIGABRT (Abort)
matchai commented 5 years ago

Huh... definitely unusual. πŸ€” Spacefish uses jq to get the package version from package.json if it is available. My first impression is that something is acting strangely with your jq installation that is causing the SIGABRT.

Could you please try running the following from a directory with a package.json:

jq -r '.version' package.json

Maybe try updating your local installation of jq.

tlpbu commented 5 years ago

@matchai Additional context block contains the output after running jq -r '.version' package.json which I found the code. The thing is I have never explicitly installed jq - did not even know about it till yesterday. My wild guess is that some other app has it installed as dependency somewhere and spacefish detects it as present. Otherwise jq -r '.version' package.json would outpus oemthing like fish: Unknown command 'jq'

I will get to that machine next weak and try which jq command to see where does it come from.

tlpbu commented 5 years ago

Found out jd was indeed installed on machine via brew. brew upgrade jq fixed everything and package version detection now works fine. Probably it was installed long time ago as a dependency for something and version 1.5.2 was not compatible with MacOS Majave installed later.