From 911d844402e84e41a93d337306e354c6b6d0d5ee Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Mon, 15 Jun 2015 15:03:16 -0700 Subject: [PATCH] git ssh. --- dotfiles/lib/git-ssh.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 dotfiles/lib/git-ssh.sh diff --git a/dotfiles/lib/git-ssh.sh b/dotfiles/lib/git-ssh.sh new file mode 100755 index 00000000..2d896886 --- /dev/null +++ b/dotfiles/lib/git-ssh.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# If parent command is "npm ...", then redirect stderr to /dev/null +# https://github.com/npm/npm/issues/7979#issuecomment-94953923 + +GRANDPARENT_PID=$(ps -p $PPID -o ppid=) + +if ps -p $GRANDPARENT_PID -o command= | grep -q -P "^npm"; then + ssh "$@" 2>/dev/null +else + ssh "$@" +fi