'Bash file doesnt work when it is launched from ruby script, but works with the same entry manually
I have a very strange situation. I have a command in some ruby script, which launches a bash file with some parameters.
It looks like this in ruby
res=`/usr/bin/some-file #{script_options}`
And there is some strange behavior. If script_options includes some russian symbols, bash script doesn't working
But if I launch bash script manually from command line with exactly script-options, all works properly.
Do you have any ideas what it could be, or should I update this question and show some code examples?
EDIT
part of ruby code:
def restore_backup(id, options)
script_options="#{id}"
if options[:datastoreid]
script_options="#{script_options} -d #{options[:datastoreid]}"
end
if options[:name]
script_options="#{script_options} -n \"#{options[:name]}\""
end
err=0
File.write('/opt/restore_script_opt', script_options)
res=`/usr/bin/one-restorevm #{script_options}`
if !$?.success?
err=1
end
puts res
return err
end
So, this is how function defined. But if script_options contains some russian symbols like
18 -d 1 -n "лштнфум", bash script launched by this function doesn't work
If I run it from command line, like
one-restorevm 18 -d 1 -n "лштнфум"
all is working. Also, if the script is launched by this function with only English symbols - all is also working
Thank you
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
