Class: PWN::Plugins::Log::DebugStderrTee
- Inherits:
-
Object
- Object
- PWN::Plugins::Log::DebugStderrTee
show all
- Defined in:
- lib/pwn/plugins/log.rb
Overview
Ruby Thread.report_on_exception dumps IOError to $stderr. Clone that
(and any other stderr from pwn-ai) into the open RN request log.
Instance Method Summary
collapse
Constructor Details
Returns a new instance of DebugStderrTee.
242
243
244
|
# File 'lib/pwn/plugins/log.rb', line 242
def initialize(opts = {})
@orig = opts[:orig] || $stderr
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(mid) ⇒ Object
314
315
316
|
# File 'lib/pwn/plugins/log.rb', line 314
def method_missing(mid, ...)
@orig.public_send(mid, ...)
end
|
Instance Method Details
#<<(obj) ⇒ Object
257
258
259
260
|
# File 'lib/pwn/plugins/log.rb', line 257
def <<(obj)
write(obj.to_s)
self
end
|
#close ⇒ Object
289
290
291
|
# File 'lib/pwn/plugins/log.rb', line 289
def close
nil
end
|
#closed? ⇒ Boolean
293
294
295
|
# File 'lib/pwn/plugins/log.rb', line 293
def closed?
false
end
|
#fileno ⇒ Object
285
286
287
|
# File 'lib/pwn/plugins/log.rb', line 285
def fileno
@orig.fileno if @orig.respond_to?(:fileno)
end
|
#flush ⇒ Object
276
277
278
279
|
# File 'lib/pwn/plugins/log.rb', line 276
def flush
@orig.flush if @orig.respond_to?(:flush)
self
end
|
#print(*args) ⇒ Object
271
272
273
274
|
# File 'lib/pwn/plugins/log.rb', line 271
def print(*args)
write(args.join)
nil
end
|
#puts(*args) ⇒ Object
262
263
264
265
266
267
268
269
|
# File 'lib/pwn/plugins/log.rb', line 262
def puts(*args)
if args.empty?
write("\n")
else
args.each { |a| write("#{a}\n") }
end
nil
end
|
#respond_to_missing?(mid, include_all = false) ⇒ Boolean
310
311
312
|
# File 'lib/pwn/plugins/log.rb', line 310
def respond_to_missing?(mid, include_all = false)
@orig.respond_to?(mid, include_all)
end
|
#sync ⇒ Object
297
298
299
|
# File 'lib/pwn/plugins/log.rb', line 297
def sync
@orig.respond_to?(:sync) ? @orig.sync : true
end
|
#sync=(val) ⇒ Object
301
302
303
304
|
# File 'lib/pwn/plugins/log.rb', line 301
def sync=(val)
@orig.sync = val if @orig.respond_to?(:sync=)
val
end
|
#to_io ⇒ Object
306
307
308
|
# File 'lib/pwn/plugins/log.rb', line 306
def to_io
@orig.respond_to?(:to_io) ? @orig.to_io : @orig
end
|
#tty? ⇒ Boolean
281
282
283
|
# File 'lib/pwn/plugins/log.rb', line 281
def tty?
@orig.respond_to?(:tty?) && @orig.tty?
end
|
#write(*args) ⇒ Object
246
247
248
249
250
251
252
253
254
255
|
# File 'lib/pwn/plugins/log.rb', line 246
def write(*args)
data = args.join
begin
@orig.write(data) if @orig.respond_to?(:write)
rescue StandardError
nil
end
PWN::Plugins::Log.capture_stderr!(text: data)
data.bytesize
end
|