[GRASS-dev] [GRASS GIS] #1342: grass.core.find_program() problem with ssh and other

#1342: grass.core.find_program() problem with ssh and other
---------------------------------+------------------------------------------
Reporter: lucadelu | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Python | Version: svn-trunk
Keywords: python find_program | Platform: Linux
      Cpu: Unspecified |
---------------------------------+------------------------------------------
there are some program that print help message to stderr instead stdout
and this return false instead true in grass.core.find_program().[[BR]]
With martin we see:[[BR]]
ssh --help[[BR]]
echo $?[[BR]]
255[[BR]]

instead[[BR]]
svn --help[[BR]]
echo $?[[BR]]
0

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1342&gt;
GRASS GIS <http://grass.osgeo.org>

#1342: grass.core.find_program() problem with ssh and other
---------------------------------+------------------------------------------
Reporter: lucadelu | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Python | Version: svn-trunk
Keywords: python find_program | Platform: Linux
      Cpu: Unspecified |
---------------------------------+------------------------------------------

Comment(by glynn):

Replying to [ticket:1342 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".

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1342#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1342: grass.core.find_program() problem with ssh and other
-----------------------+----------------------------------------------------
  Reporter: lucadelu | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.0.0
Component: Python | Version: svn-trunk
Resolution: invalid | Keywords: python find_program
  Platform: Linux | Cpu: Unspecified
-----------------------+----------------------------------------------------
Changes (by lucadelu):

  * status: new => closed
  * resolution: => invalid

Comment:

Replying to [comment:1 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

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1342#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>