summaryrefslogtreecommitdiff
path: root/components/stream.rb
diff options
context:
space:
mode:
authoricebaker <113217272+icebaker@users.noreply.github.com>2023-11-29 07:53:19 -0300
committerGitHub <noreply@github.com>2023-11-29 07:53:19 -0300
commit9f79a161905f5af8e331930cc77c7be10703596f (patch)
treeb2ab75665e42de79f22cca82bf03cfc49759f485 /components/stream.rb
parente1ab6853262b83f483060961f17bf895989a19c0 (diff)
parent154aa68caf50a18af5c0dff1d368fc639314e0ba (diff)
Merge pull request #5 from icebaker/ib-tools
Adding support for Spec 1.0.0: Tools (Functions)
Diffstat (limited to 'components/stream.rb')
-rw-r--r--components/stream.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/components/stream.rb b/components/stream.rb
index 45c4a2b..347eb87 100644
--- a/components/stream.rb
+++ b/components/stream.rb
@@ -7,7 +7,12 @@ module NanoBot
class Stream < StringIO
def write(*args)
if @callback
- @accumulated += args.first
+ begin
+ @accumulated += args.first
+ rescue StandardError => _e
+ @accumulated = "#{@accumulated.force_encoding('UTF-8')}#{args.first.force_encoding('UTF-8')}"
+ end
+
@callback.call(@accumulated, args.first, false)
end
super