From 924256d6b37c9e7a70440bc6e20e5d51223a8373 Mon Sep 17 00:00:00 2001 From: Jerome Lacoste Date: Wed, 29 Nov 2023 08:55:02 +0100 Subject: [PATCH] Hide xcodebuild stderr to solve #21672 --- fastlane_core/lib/fastlane_core/project.rb | 2 ++ fastlane_core/spec/project_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fastlane_core/lib/fastlane_core/project.rb b/fastlane_core/lib/fastlane_core/project.rb index 803f074cba9..da5ebfcf00b 100644 --- a/fastlane_core/lib/fastlane_core/project.rb +++ b/fastlane_core/lib/fastlane_core/project.rb @@ -418,6 +418,8 @@ def build_settings(key: nil, optional: true) command = build_xcodebuild_showbuildsettings_command + command = "#{command} 2>&1" # xcodebuild produces errors on stderr #21672 + # Xcode might hang here and retrying fixes the problem, see fastlane#4059 begin timeout = FastlaneCore::Project.xcode_build_settings_timeout diff --git a/fastlane_core/spec/project_spec.rb b/fastlane_core/spec/project_spec.rb index 67c7fb80d06..3ec3c703247 100644 --- a/fastlane_core/spec/project_spec.rb +++ b/fastlane_core/spec/project_spec.rb @@ -346,7 +346,7 @@ def within_a_temp_dir allow(FastlaneCore::Helper).to receive(:xcode_at_least?).with("11.0").and_return(false) allow(FastlaneCore::Helper).to receive(:xcode_at_least?).with("13").and_return(false) expect(FastlaneCore::Helper).to receive(:xcode_at_least?).with("8.3").and_return(true) - command = "xcodebuild -showBuildSettings -project ./fastlane_core/spec/fixtures/projects/Example.xcodeproj" + command = "xcodebuild -showBuildSettings -project ./fastlane_core/spec/fixtures/projects/Example.xcodeproj 2>&1" expect(FastlaneCore::Project).to receive(:run_command).with(command.to_s, { timeout: 3, retries: 3, print: true }).and_return(File.read("./fastlane_core/spec/fixtures/projects/build_settings_with_toolchains")) expect(@project.build_settings(key: "SUPPORTED_PLATFORMS")).to eq("iphonesimulator iphoneos") end @@ -357,7 +357,7 @@ def within_a_temp_dir allow(FastlaneCore::Helper).to receive(:xcode_at_least?).with("11.0").and_return(false) allow(FastlaneCore::Helper).to receive(:xcode_at_least?).with("13").and_return(false) expect(FastlaneCore::Helper).to receive(:xcode_at_least?).with("8.3").and_return(false) - command = "xcodebuild clean -showBuildSettings -project ./fastlane_core/spec/fixtures/projects/Example.xcodeproj" + command = "xcodebuild clean -showBuildSettings -project ./fastlane_core/spec/fixtures/projects/Example.xcodeproj 2>&1" expect(FastlaneCore::Project).to receive(:run_command).with(command.to_s, { timeout: 3, retries: 3, print: true }).and_return(File.read("./fastlane_core/spec/fixtures/projects/build_settings_with_toolchains")) expect(@project.build_settings(key: "SUPPORTED_PLATFORMS")).to eq("iphonesimulator iphoneos") end