dongjoon-hyun opened a new pull request #29241:
URL: https://github.com/apache/spark/pull/29241


   ### What changes were proposed in this pull request?
   
   Currently, Apache Spark literally executes a given command to check the 
existence. This is dangerous and doesn't work sometimes. This PR aims to use 
`command -v`. `command` is POSIX-compatible and a light-weight and safe way to 
check the availability.
   
   - **POSIX.1-2017**: `command` 
https://pubs.opengroup.org/onlinepubs/9699919799/
   
   ### Why are the changes needed?
   
   ```scala
   scala> sys.process.Process("cat").run().exitValue()
   res0: Int = 0
   
   scala> sys.process.Process("ls").run().exitValue()
   LICENSE
   NOTICE
   bin
   doc
   lib
   man
   res1: Int = 0
   
   scala> sys.process.Process("rm").run().exitValue()
   usage: rm [-f | -i] [-dPRrvW] file ...
          unlink file
   res4: Int = 64
   ```
   
   ```
   scala> sys.process.Process("command -v rm").run().exitValue()
   /bin/rm
   res5: Int = 0
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. Although this is inside `main` source directory, this is used for 
testing purpose.
   
   ### How was this patch tested?
   
   Pass the Jenkins with the existing tests.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to