require 'shell'
sh = Shell.new
sh.verbose = false
sh.debug = false
print sh.system('date')
Wed Nov 10 13:08:09 EST 2021
shell(#<Th:0x00007fd016064058 run>): /bin/date
Wed Nov 10 13:08:09 EST 2021
The unwanted line comes from Shell::CommandProcessor#notify
After some investigation there seems to be a confusing design flaw (or feature?) in Shell
. Initally it seems you should be able to mutate verbose
and debug
on an instance of Shell
, but it turns out the root notify
method itself lives in the class , not the instance.
Hence instance level settings will only have limited effect, as the class method Shell.notify
will be unaware of instance settings.
Solution - use class-level settings instead:
Shell.verbose = false
Shell.debug = false
Output will now be only:
Wed Nov 10 13:08:09 EST 2021
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.