Skip to content

Commit 9bf7dd7

Browse files
committed
Launch elf interpreter explictly on nixos
1 parent 0e4c035 commit 9bf7dd7

File tree

3 files changed

+14
-19
lines changed

3 files changed

+14
-19
lines changed

exe/sass

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,7 @@ require_relative '../ext/sass/cli'
66
module Sass
77
# The `sass` command line interface
88
module CLI
9-
begin
10-
Kernel.exec(*COMMAND, *ARGV)
11-
rescue Errno::ENOENT
12-
require_relative '../lib/sass/elf'
13-
14-
raise if ELF::INTERPRETER.nil?
15-
16-
Kernel.exec(ELF::INTERPRETER, *COMMAND, *ARGV)
17-
end
9+
Kernel.exec(*COMMAND, *ARGV)
1810
end
1911

2012
private_constant :CLI

ext/sass/Rakefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,20 @@ file 'cli.rb' => %w[dart-sass] do |t|
5353
File.write(t.name, <<~CLI_RB)
5454
# frozen_string_literal: true
5555
56+
require_relative '../../lib/sass/elf'
57+
5658
module Sass
59+
# The [CLI] module.
5760
module CLI
58-
COMMAND = [#{command}].freeze
61+
command = [#{command}]
62+
63+
command.unshift(ELF::INTERPRETER) unless ELF::INTERPRETER.nil? || File.open(command[0], 'rb') do |file|
64+
File.exist?(ELF.new(file).interpreter)
65+
rescue StandardError
66+
false
67+
end
68+
69+
COMMAND = command.freeze
5970
end
6071
6172
private_constant :CLI

lib/sass/compiler/connection.rb

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,7 @@ class Compiler
1212
class Connection
1313
def initialize
1414
@mutex = Mutex.new
15-
@stdin, @stdout, @stderr, @wait_thread = begin
16-
Open3.popen3(*CLI::COMMAND, '--embedded', chdir: __dir__)
17-
rescue Errno::ENOENT
18-
require_relative '../elf'
19-
20-
raise if ELF::INTERPRETER.nil?
21-
22-
Open3.popen3(ELF::INTERPRETER, *CLI::COMMAND, '--embedded', chdir: __dir__)
23-
end
15+
@stdin, @stdout, @stderr, @wait_thread = Open3.popen3(*CLI::COMMAND, '--embedded', chdir: __dir__)
2416

2517
@stdin.binmode
2618

0 commit comments

Comments
 (0)