Skip to content

Commit

Permalink
Fix the order of the Open3.capture3 output. The stdout, stderr and st…
Browse files Browse the repository at this point in the history
…atus values are not correctly used and printed.
  • Loading branch information
aschuch committed Mar 16, 2016
1 parent bda184a commit 95c9990
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
11 changes: 4 additions & 7 deletions lib/fame/xliff_export.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,10 @@ def export_xliffs(path)
.join(" ")

command = "xcodebuild -exportLocalizations -localizationPath \"#{path}\" -project \"#{@xcode_proj.xcode_proj_path}\" #{languages}"

stdin, stdout, stderr = Open3.capture3(command)
if stderr
puts(command.blue)
puts(stdout.light_black)
puts(stderr.to_s.yellow)
end
stdout, stderr, status = Open3.capture3(command)

puts stdout.light_black
puts(stderr.yellow) unless status.success?
end

#
Expand Down
11 changes: 6 additions & 5 deletions lib/fame/xliff_import.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,17 @@ def import(path)
# may result in the following error:
# xcodebuild: error: Importing localizations from en.xliff will make changes to Example. Import with xcodebuild can only modify existing strings files.
command = "xcodebuild -importLocalizations -localizationPath \"#{xliff}\" -project \"#{@xcode_proj.xcode_proj_path}\""
_, stdout, stderr = Open3.capture3(command)
stdout, stderr, status = Open3.capture3(command)

puts stdout.light_black
if stderr
if status.success?
puts stdout.light_black
puts "✔︎ Successfully imported #{language}".green
else
puts stderr.light_black
puts "✘ Failed to import #{language}".red
# grep the error specific to the initial import issue of xcodebuild
error = stdout.split("\n").grep(/^xcodebuild: error: Importing localizations/i)
errors << error
else
puts "✔︎ Successfully imported #{language}".green
end
end

Expand Down

0 comments on commit 95c9990

Please sign in to comment.