Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-25075 Build and test Spark against Scala 2.13
  3. SPARK-32443

Fix testCommandAvailable to use POSIX compatible `command -v`

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.1.3, 2.2.3, 2.3.4, 2.4.6, 3.0.0
    • 3.1.0
    • Spark Core
    • None

    Description

      Currently, we run the command to check the existence. This is dangerous and doesn't work sometimes.

      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
      

      Attachments

        Activity

          People

            hyukjin.kwon Hyukjin Kwon
            dongjoon Dongjoon Hyun
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: