Skip to content

Commit 620838a

Browse files
committed
:NixShell: Handle failures
Don't proceed on failure and print an error message.
1 parent 3f02e76 commit 620838a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

plugin/nix.vim

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,13 @@ endfunction
3232

3333
" See command :NixShell
3434
function! nix#add_pkg_to_env(args)
35-
echo "nix-shell " . a:args
35+
let l:displaycmd = "nix-shell " . a:args
36+
echo l:displaycmd
3637
let l:env = systemlist("nix-shell --run env " . a:args)
38+
if v:shell_error
39+
echo "Command failed: " . l:displaycmd
40+
return
41+
endif
3742
call nix#set_env(l:env)
3843
echo "Environment updated"
3944
endfunction

0 commit comments

Comments
 (0)