From 767d44621b307964c2219bdf7863012220dac5eb Mon Sep 17 00:00:00 2001 From: Paulo McNally Date: Fri, 24 Feb 2023 11:41:15 -0600 Subject: [PATCH 1/2] support m1 --- bin/wkhtmltoimage | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/wkhtmltoimage b/bin/wkhtmltoimage index b2f3887..fea64e6 100755 --- a/bin/wkhtmltoimage +++ b/bin/wkhtmltoimage @@ -1,5 +1,7 @@ #!/usr/bin/env ruby +require 'rbconfig' + arch = case RUBY_PLATFORM when /64.*linux/ 'amd64' @@ -13,6 +15,9 @@ arch = case RUBY_PLATFORM raise "Invalid platform. Must be running linux or Mac." end +host_cpu = RbConfig::CONFIG['host_cpu'] +arch = 'darwin-x64' if host_cpu == 'arm' + args = $*.map { |x| x.include?(' ') ? "'" + x + "'" : x } cmd = File.expand_path "#{File.dirname(__FILE__)}/../libexec/wkhtmltoimage-#{arch}" From 9e9851ab2bc9ca167043804659ac5e8d2914e374 Mon Sep 17 00:00:00 2001 From: Paulo McNally Date: Fri, 24 Feb 2023 11:47:08 -0600 Subject: [PATCH 2/2] validate arch for darwin --- bin/wkhtmltoimage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/wkhtmltoimage b/bin/wkhtmltoimage index fea64e6..ffc75ce 100755 --- a/bin/wkhtmltoimage +++ b/bin/wkhtmltoimage @@ -16,7 +16,7 @@ arch = case RUBY_PLATFORM end host_cpu = RbConfig::CONFIG['host_cpu'] -arch = 'darwin-x64' if host_cpu == 'arm' +arch = 'darwin-x64' if host_cpu == 'arm' && arch == 'darwin-x86' args = $*.map { |x| x.include?(' ') ? "'" + x + "'" : x } cmd = File.expand_path "#{File.dirname(__FILE__)}/../libexec/wkhtmltoimage-#{arch}"