From eba73d9b61660a2cb40b15f437d11c8fffa968a2 Mon Sep 17 00:00:00 2001 From: Takuro Ashie Date: Mon, 30 Mar 2020 12:46:41 +0900 Subject: [PATCH] Allow to launch fluentd from `C:\Program Files\` On testing arguments in RUBYOPT, command line arguments aren't quoted so that it will fail if ruby command (which is passed as the first arugment) is placed under a directory which contains spaces. Use `spawn(program, *args)` instead of `spawn(command, options={})` to fix it. Signed-off-by: Takuro Ashie --- lib/fluent/supervisor.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/fluent/supervisor.rb b/lib/fluent/supervisor.rb index b02b5f623f..0597ba09f0 100644 --- a/lib/fluent/supervisor.rb +++ b/lib/fluent/supervisor.rb @@ -897,10 +897,9 @@ def build_spawn_command # Adding `-h` so that it can avoid ruby's command blocking # e.g. `ruby -Eascii-8bit:ascii-8bit` will block. but `ruby -Eascii-8bit:ascii-8bit -h` won't. - cmd = fluentd_spawn_cmd.join(' ') - _, e, s = Open3.capture3("#{cmd} -h") + _, e, s = Open3.capture3(*fluentd_spawn_cmd, "-h") if s.exitstatus != 0 - $log.error('Invalid option is passed to RUBYOPT', command: cmd, error: e) + $log.error('Invalid option is passed to RUBYOPT', command: fluentd_spawn_cmd, error: e) exit s.exitstatus end