Opened 13 years ago

Closed 13 years ago

#1342 closed defect (invalid)

grass.core.find_program() problem with ssh and other

Reported by: lucadelu Owned by: grass-dev@…
Priority: normal Milestone: 7.0.0
Component: Python Version: svn-trunk
Keywords: python find_program Cc:
CPU: Unspecified Platform: Linux

Description

there are some program that print help message to stderr instead stdout and this return false instead true in grass.core.find_program().
With martin we see:
ssh --help
echo $?
255

instead
svn --help
echo $?
0

Change History (2)

in reply to:  description ; comment:1 by glynn, 13 years ago

Replying to lucadelu:

there are some program that print help message to stderr instead stdout and this return false instead true in grass.core.find_program().

Whether the program prints anything to either stream is entirely irrelevant; find_program() simply checks the return code.

In order for find_program() to work, you need to find some invocation which returns a zero exit status (indicating success). If running the command with --help is considered an error (non-zero exit status), you'll need to find some other option. E.g. for ssh, you can use "ssh -V".

in reply to:  1 comment:2 by lucadelu, 13 years ago

Resolution: invalid
Status: newclosed

Replying to glynn:

In order for find_program() to work, you need to find some invocation which returns a zero exit status (indicating success). If running the command with --help is considered an error (non-zero exit status), you'll need to find some other option. E.g. for ssh, you can use "ssh -V".

Ok, thanks it works for me

Note: See TracTickets for help on using tickets.