Opened 9 years ago

Closed 9 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)

comment:1 in reply to:  description ; Changed 9 years ago by glynn

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".

comment:2 in reply to:  1 Changed 9 years ago by lucadelu

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.