From e4fa58c43ce2bf8d76bffb0d9dc1132f8d0eae6a Mon Sep 17 00:00:00 2001
From: Sun Rui <sunrui2016@gmail.com>
Date: Fri, 1 Jul 2016 14:37:03 -0700
Subject: [PATCH] [SPARK-16299][SPARKR] Capture errors from R workers in
 daemon.R to avoid deletion of R session temporary directory.

## What changes were proposed in this pull request?
Capture errors from R workers in daemon.R to avoid deletion of R session temporary directory. See detailed description at https://issues.apache.org/jira/browse/SPARK-16299

## How was this patch tested?
SparkR unit tests.

Author: Sun Rui <sunrui2016@gmail.com>

Closes #13975 from sun-rui/SPARK-16299.
---
 R/pkg/inst/worker/daemon.R | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/R/pkg/inst/worker/daemon.R b/R/pkg/inst/worker/daemon.R
index f55beac6c8..b92e6be995 100644
--- a/R/pkg/inst/worker/daemon.R
+++ b/R/pkg/inst/worker/daemon.R
@@ -44,7 +44,7 @@ while (TRUE) {
     if (inherits(p, "masterProcess")) {
       close(inputCon)
       Sys.setenv(SPARKR_WORKER_PORT = port)
-      source(script)
+      try(source(script))
       # Set SIGUSR1 so that child can exit
       tools::pskill(Sys.getpid(), tools::SIGUSR1)
       parallel:::mcexit(0L)
-- 
GitLab