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

    https://github.com/apache/spark/pull/10714#discussion_r49440804
  
    --- Diff: 
core/src/main/scala/org/apache/spark/util/logging/FileAppender.scala ---
    @@ -58,20 +58,29 @@ private[spark] class FileAppender(inputStream: 
InputStream, file: File, bufferSi
       protected def appendStreamToFile() {
         try {
           logDebug("Started appending thread")
    -      openFile()
    -      val buf = new Array[Byte](bufferSize)
    -      var n = 0
    -      while (!markedForStop && n != -1) {
    -        n = inputStream.read(buf)
    -        if (n != -1) {
    -          appendToFile(buf, n)
    +      Utils.tryWithSafeFinally {
    +        openFile()
    +        val buf = new Array[Byte](bufferSize)
    +        var n = 0
    +        while (!markedForStop && n != -1) {
    +          try {
    +            n = inputStream.read(buf)
    +          } catch {
    +            case e: IOException =>
    --- End diff --
    
    I don't think it's worth changing as this is fine, but I think you could 
just write
    ```
    case _: IOException if markedForStop => // do nothing because ...
    ```
    ... but maybe I'm missing something about how that works.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to