5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/elm_sprockets/compiler.rb', line 5
def self.compile(pathname, output_file, dir_options = {})
@cmd ||= "#{`npm bin`.strip}/elm-make"
puts @cmd
puts output_file.path
Open3.popen3(
{'LANG' => 'en_US.UTF-8'},
@cmd, pathname.to_s,
"--yes", "--output",
output_file.path, dir_options) do |_stdin, _stdout, stderr, wait_thr|
compiler_err = stderr.gets(nil)
stderr.close
process_status = wait_thr.value
if process_status.exitstatus != 0
fail compiler_err
end
end
end
|