New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ps option -U and -o unknown #172

Closed
Brottweiler opened this Issue Jun 13, 2014 · 2 comments

Comments

Projects
None yet
3 participants
@Brottweiler

Brottweiler commented Jun 13, 2014

I use Prezto instead of Oh-My-Zsh, and the SSH module checks if SSH-agent is running when I open babun. This works on linux, because it uses ps -U to check if it's running for my user, but the -U option doesn't exist in ps in babun.

This is how the SSH module looks like at the part where it checks if SSH-agent is started.

# Start ssh-agent if not started.
if [[ ! -S "$SSH_AUTH_SOCK" ]]; then
  # Export environment variables.
  source "$_ssh_agent_env" 2> /dev/null

  # Start ssh-agent if not started.
  if ! ps -U "$USER" -o pid,ucomm | grep -q "${SSH_AGENT_PID} ssh-agent"; then
    eval "$(ssh-agent | sed '/^echo /d' | tee "$_ssh_agent_env")"
  fi
fi

ps --help shows that -U and -o does not exist as options. Is there a package where these options are included?

@jlupi

This comment has been minimized.

Contributor

jlupi commented Jun 27, 2014

There is no -o option in cygwin's ps but there is -u:

-u, --user list processes owned by UID

You could try to replace the if with one of those (depends whether the agent is a windows or cygwin process):

if ! ps -u "$USER"  | egrep -q -e "${SSH_AGENT_PID}.*ssh-agent"; then

or

if ! ps -u "$USER" -W | egrep -q -e "${SSH_AGENT_PID}.*ssh-agent"; then
@tombujok

This comment has been minimized.

Contributor

tombujok commented Feb 4, 2015

Thanks for feedback @jlupi
Moved to FAQ and closed.

@tombujok tombujok closed this Feb 4, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment