michaelb / sniprun

A neovim plugin to run lines/blocs of code (independently of the rest of the file), supporting multiples languages
MIT License
1.44k stars 47 forks source link

Update install.sh to show the error msg when build failed #232

Closed LintaoAmons closed 1 year ago

LintaoAmons commented 1 year ago

When I build this by LazyVim, there's no error show but the binary didn't build successfully

And when I tried to build the binary from source, the outcome is like:

Runnning Sniprun Installer
Looks you are not running Linux: Mac users have to compile sniprun themselves and thus need the Rust toolchain
Compiling sniprun locally:
Building sniprun from source...
Done (status: 101)

even thought the status was 101 which indicated that there's something wrong.But not very clear.

So I think it's better to print out the error msg out to give more information when install failed.

Like in my case:

❯ bash install.sh
Runnning Sniprun Installer
Looks you are not running Linux: Mac users have to compile sniprun themselves and thus need the Rust toolchain
Compiling sniprun locally:
Building sniprun from source...
    Updating crates.io index
error: failed to download from `https://crates.io/api/v1/crates/aho-corasick/1.0.1/download`

Caused by:
  [60] SSL peer certificate or SSH remote key was not OK (SSL certificate problem: unable to get local issuer certificate)
Done (status: 101)

I could easily know the reason~

michaelb commented 1 year ago

Sure, though I think other messages are getting out now (default cargo stdout etc...).

I'll revert this change if users complain about the 'noisy' output even when the build succeeds.

LintaoAmons commented 1 year ago

Oh, I see. So maybe only show the stderr, discard stdout?

cargo build --release > /dev/null