have an next case:
test3 = Mixlib::ShellOut.new("echo '1'")
test4 = Mixlib::ShellOut.new("mysql -u root --silent --skip-column-names --password='rootpass' -e 'some sql;'")
test3.run_command
test4.run_command
puts test3.stdout # => 1
puts test4.stdout # => empty string, nothing
expecting test4 to return result as test3
I guess maybe mysql returning result not to stdout, where then and how can I get the result
PS I know about ruby gem mysql2 which I could use for doing this stuff, but to be honest no time to implement stuff like this just to getting only a simple SQL result, also I have tried run command without --silent and --skip-column-names flags, and this doesn't help too.
所以问题是,我的命令正在返回代码出口1,看来它失败了,因此,在修复了命令后,问题就出在使用单逗号而不是双逗号
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.