Skip to content

Commit a1377a2

Browse files
committed
move exec into Command class
1 parent b4bdbfb commit a1377a2

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

lib/jruby_art/command.rb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,17 @@ def initialize(executable:, runner:, args:, filename:)
1313
end
1414

1515
def cmd(root)
16-
return [executable, JRubyOpts.new(root).opts, runner, filename, args].flatten if executable =~ /jruby/
17-
[executable, JavaOpts.new(root).opts, '-cp', JRubyComplete.complete, 'org.jruby.Main', runner, filename, args].flatten
16+
if executable =~ /jruby/
17+
cmda = [executable, JRubyOpts.new(root).opts, runner, filename, args].flatten
18+
else
19+
cmda = [executable, JavaOpts.new(root).opts, '-cp', JRubyComplete.complete, 'org.jruby.Main', runner, filename, args].flatten
20+
end
21+
begin
22+
# exec(*command)
23+
exec(*cmda)
24+
# exec replaces the Ruby process with the JRuby one.
25+
rescue Java::JavaLang::ClassNotFoundException
26+
end
1827
end
1928
end
2029
end

lib/jruby_art/runner.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,7 @@ def spin_up(starter_script, filename, argc)
169169
args: argc,
170170
filename: filename
171171
)
172-
begin
173-
# exec(*command)
174-
exec(*build.cmd(SKETCH_ROOT))
175-
# exec replaces the Ruby process with the JRuby one.
176-
rescue Java::JavaLang::ClassNotFoundException
177-
end
172+
build.cmd(SKETCH_ROOT)
178173
end
179174

180175
# NB: We really do mean to use 'and' not '&&' for flow control purposes

0 commit comments

Comments
 (0)