diff --git a/r/R/arrow-package.R b/r/R/arrow-package.R index 8655bf5a1cc68..eec95b8282bfd 100644 --- a/r/R/arrow-package.R +++ b/r/R/arrow-package.R @@ -241,12 +241,6 @@ on_macos_10_13_or_lower <- function() { package_version(unname(Sys.info()["release"])) < "18.0.0" } -on_rosetta <- function() { - # make sure to suppress warnings and ignore the stdout + stderr so that this is silent - identical(tolower(Sys.info()[["sysname"]]), "darwin") && - identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)), "1") -} - option_use_threads <- function() { !is_false(getOption("arrow.use_threads")) } diff --git a/r/R/install-arrow.R b/r/R/install-arrow.R index 715478f6d0542..6db6f2b0adaa3 100644 --- a/r/R/install-arrow.R +++ b/r/R/install-arrow.R @@ -79,7 +79,8 @@ install_arrow <- function(nightly = FALSE, # On the M1, we can't use the usual autobrew, which pulls Intel dependencies apple_m1 <- grepl("arm-apple|aarch64.*darwin", R.Version()$platform) # On Rosetta, we have to build without JEMALLOC, so we also can't autobrew - if (on_rosetta()) { + rosetta <- on_rosetta() + if (rosetta) { Sys.setenv(ARROW_JEMALLOC = "OFF") } if (apple_m1 || rosetta) { @@ -267,3 +268,9 @@ wslify_path <- function(path) { end_path <- strsplit(path, drive_expr)[[1]][-1] file.path(wslified_drive, end_path) } + +on_rosetta <- function() { + # make sure to suppress warnings and ignore the stderr so that this is silent where proc_translated doesn't exist + identical(tolower(Sys.info()[["sysname"]]), "darwin") && + identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)), "1") +} diff --git a/r/tests/testthat/test-arrow-pacakge.R b/r/tests/testthat/test-arrow-pacakge.R deleted file mode 100644 index 2d79467fa30a9..0000000000000 --- a/r/tests/testthat/test-arrow-pacakge.R +++ /dev/null @@ -1,21 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -test_that("on_rosetta() does not warn", { - # There is no warning - expect_warning(on_rosetta(), NA) -}) diff --git a/r/tests/testthat/test-install-arrow.R b/r/tests/testthat/test-install-arrow.R index 787c8ea2c018c..5415fc27581cc 100644 --- a/r/tests/testthat/test-install-arrow.R +++ b/r/tests/testthat/test-install-arrow.R @@ -33,3 +33,8 @@ test_that("arrow_repos", { expect_identical(arrow_repos(c(ours, other), nightly = TRUE), c(ours, other)) }) }) + +test_that("on_rosetta() does not warn", { + # There is no warning + expect_warning(on_rosetta(), NA) +})