Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21368#discussion_r189681355
  
    --- Diff: 
repl/scala-2.12/src/main/scala/org/apache/spark/repl/SparkILoop.scala ---
    @@ -37,7 +37,14 @@ class SparkILoop(in0: Option[BufferedReader], out: 
JPrintWriter)
         @transient val spark = if (org.apache.spark.repl.Main.sparkSession != 
null) {
             org.apache.spark.repl.Main.sparkSession
           } else {
    -        org.apache.spark.repl.Main.createSparkSession()
    +        try {
    +          org.apache.spark.repl.Main.createSparkSession()
    +        } catch {
    +          case e: Exception =>
    +            println("Failed to initialize Spark session:")
    +            e.printStackTrace()
    +            sys.exit(1)
    +        }
    --- End diff --
    
    SparkR already does something close to this:
    
    ```
      # 0 is success and +1 is reserved for heartbeats. Other negative values 
indicate errors.
      if (returnStatus < 0) {
        stop(readString(conn))
      }
    ```
    
    Except that "stop()" doesn't actually exit the shell. That's probably by 
design, so unless @felixcheung  says it's ok to exit the shell (and tells me 
how), I'll leave things as is.


---

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

Reply via email to