🎨 Use Mac environment variable

Switch to io.popen to allow the passing of the LANG environment variable
This commit is contained in:
TheColorman 2023-06-26 15:19:54 +02:00
parent 6c571a8296
commit 667b8c432c
No known key found for this signature in database
GPG key ID: A9C799E05AC900AF

View file

@ -48,7 +48,14 @@ this.clipboard = (function()
elseif this.platform == this.Platform.macos then
self.clip_exe = "pbcopy"
self.copy = function(text)
return h.subprocess({ self.clip_exe, }, text)
local handle = io.popen("LANG=en_US.UTF-8 pbcopy", 'w')
if handle then
handle:write(text)
local suc, exit, code = handle:close()
return { status = code }
else
return { status = 1 }
end
end
else
self.clip_exe = h.is_wayland() and "wl-copy" or "xclip"