This is an automated email from the ASF dual-hosted git repository.

thisisnic pushed a commit to branch maint-25.0.0-r
in repository https://gitbox.apache.org/repos/asf/arrow.git

commit 981c9caa6ffda4b4579596dbb1080ff1d088ba78
Author: Rok Mihevc <[email protected]>
AuthorDate: Mon Jul 6 11:37:46 2026 +0200

    MINOR: [R] Adjust parallel::detectCores if NA to not break --parallel input 
in CMake (#50317)
    
    ### Rationale for this change
    
    See [failure 
here](https://github.com/ursacomputing/crossbow/actions/runs/28486933942/job/84435321636#step:6:719).
    
    ### What changes are included in this PR?
    
    Bash command used is adjusted to prevent this error.
    ```bash
    /usr/bin/cmake --build . --target install -- -j 2
    gmake: the '-j' option requires a positive integer argument
    ```
    
    ### Are these changes tested?
    
    By CI.
    
    ### Are there any user-facing changes?
    
    No.
    
    Lead-authored-by: Rok Mihevc <[email protected]>
    Co-authored-by: Copilot Autofix powered by AI 
<[email protected]>
    Signed-off-by: Rok Mihevc <[email protected]>
---
 r/tools/nixlibs.R | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R
index ba705e03ad..dd230c3764 100644
--- a/r/tools/nixlibs.R
+++ b/r/tools/nixlibs.R
@@ -526,7 +526,8 @@ build_libarrow <- function(src_dir, dst_dir) {
   # Set up make for parallel building
   # CRAN policy says not to use more than 2 cores during checks
   # If you have more and want to use more, set MAKEFLAGS or NOT_CRAN
-  ncores <- parallel::detectCores()
+  # detectCores() returns NA if number of cores is unknown. Set ncores to 1 if 
NA.
+  ncores <- max(1, parallel::detectCores(), na.rm = TRUE)
   if (!not_cran) {
     ncores <- min(ncores, 2)
   }

Reply via email to