require 'shell'
sh = Shell.new
sh.verbose = false
sh.debug = false
print sh.system('date')
Expected output
Wed Nov 10 13:08:09 EST 2021
Observed output
shell(#<Th:0x00007fd016064058 run>): /bin/date
Wed Nov 10 13:08:09 EST 2021
The unwanted line comes from Shell::CommandProcessor#notify
CodePudding user response:
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