diff options
author | Stan Lo <[email protected]> | 2024-06-18 16:15:19 +0100 |
---|---|---|
committer | git <[email protected]> | 2024-06-18 15:15:23 +0000 |
commit | 921f22e563d6372d9f853f87d48b11c479126da9 (patch) | |
tree | ef0fdc855ed5fddc52bb22df86e747e906f9abd3 /lib | |
parent | c2e2c5975d576076bb3e77524d5458d28e761742 (diff) |
[ruby/irb] Improve how command calls' return value is handled
(https://github.com/ruby/irb/pull/972)
In #934, we changed command calls to return nil only. This PR improves
the behaviour even further by:
- Not echoing the `nil` returned by command calls
- Not overriding previous return value stored in `_` with the
`nil` from commands
https://github.com/ruby/irb/commit/c844176842
Diffstat (limited to 'lib')
-rw-r--r-- | lib/irb/context.rb | 1 | ||||
-rw-r--r-- | lib/irb/statement.rb | 2 |
2 files changed, 1 insertions, 2 deletions
diff --git a/lib/irb/context.rb b/lib/irb/context.rb index aafce7aade..74a08ca694 100644 --- a/lib/irb/context.rb +++ b/lib/irb/context.rb @@ -602,7 +602,6 @@ module IRB set_last_value(result) when Statement::Command statement.command_class.execute(self, statement.arg) - set_last_value(nil) end nil diff --git a/lib/irb/statement.rb b/lib/irb/statement.rb index a3391c12a3..9591a40357 100644 --- a/lib/irb/statement.rb +++ b/lib/irb/statement.rb @@ -68,7 +68,7 @@ module IRB end def suppresses_echo? - false + true end def should_be_handled_by_debugger? |