Skip to content

Commit 14a837a

Browse files
committed
- Re-fix Open3 options error on jRuby
1 parent 45ff332 commit 14a837a

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/libreconv.rb

+9-5
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def convert
4949

5050
Dir.mktmpdir do |target_path|
5151
command = build_command(tmp_pipe_path, target_path)
52-
target_tmp_file = execute_command(command, target_path)
52+
target_tmp_file = execute_command(command, target_path, RUBY_PLATFORM =~ /java/)
5353

5454
FileUtils.cp target_tmp_file, @target
5555
end
@@ -63,9 +63,13 @@ def convert
6363
# @param [String] target_path
6464
# @return [String]
6565
# @raise [ConversionFailedError] When soffice command execution error.
66-
def execute_command(command, target_path)
67-
opts = RUBY_PLATFORM =~ /java/ ? {} : { unsetenv_others: true }
68-
output, error, status = Open3.capture3 command_env, *command, opts
66+
def execute_command(command, target_path, is_jruby = false)
67+
output, error, status =
68+
if is_jruby
69+
Open3.capture3 command_env, *command
70+
else
71+
Open3.capture3 command_env, *command, unsetenv_others: true
72+
end
6973

7074
target_tmp_file = File.join(target_path, target_filename)
7175
return target_tmp_file if status.success? && File.exist?(target_tmp_file)
@@ -81,7 +85,7 @@ def command_env
8185

8286
# @param [String] tmp_pipe_path
8387
# @param [String] target_path
84-
# @return [Array]
88+
# @return [Array<String>]
8589
def build_command(tmp_pipe_path, target_path)
8690
[
8791
soffice_command,

0 commit comments

Comments
 (0)