Ticket #1342 (closed defect: invalid)

Opened 2 years ago

Last modified 2 years ago

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:
Platform: Linux CPU: Unspecified

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

in reply to: ↑ description ; follow-up: ↓ 2   Changed 2 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".

in reply to: ↑ 1   Changed 2 years ago by lucadelu

  • status changed from new to closed
  • resolution set to invalid

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.