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.
253
254
255
|
# File 'lib/pwn/plugins/log.rb', line 253
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
325
326
327
|
# File 'lib/pwn/plugins/log.rb', line 325
def method_missing(mid, ...)
@orig.public_send(mid, ...)
end
|
Instance Method Details
#<<(obj) ⇒ Object
268
269
270
271
|
# File 'lib/pwn/plugins/log.rb', line 268
def <<(obj)
write(obj.to_s)
self
end
|
#close ⇒ Object
300
301
302
|
# File 'lib/pwn/plugins/log.rb', line 300
def close
nil
end
|
#closed? ⇒ Boolean
304
305
306
|
# File 'lib/pwn/plugins/log.rb', line 304
def closed?
false
end
|
#fileno ⇒ Object
296
297
298
|
# File 'lib/pwn/plugins/log.rb', line 296
def fileno
@orig.fileno if @orig.respond_to?(:fileno)
end
|
#flush ⇒ Object
287
288
289
290
|
# File 'lib/pwn/plugins/log.rb', line 287
def flush
@orig.flush if @orig.respond_to?(:flush)
self
end
|
#print(*args) ⇒ Object
282
283
284
285
|
# File 'lib/pwn/plugins/log.rb', line 282
def print(*args)
write(args.join)
nil
end
|
#puts(*args) ⇒ Object
273
274
275
276
277
278
279
280
|
# File 'lib/pwn/plugins/log.rb', line 273
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
321
322
323
|
# File 'lib/pwn/plugins/log.rb', line 321
def respond_to_missing?(mid, include_all = false)
@orig.respond_to?(mid, include_all)
end
|
#sync ⇒ Object
308
309
310
|
# File 'lib/pwn/plugins/log.rb', line 308
def sync
@orig.respond_to?(:sync) ? @orig.sync : true
end
|
#sync=(val) ⇒ Object
312
313
314
315
|
# File 'lib/pwn/plugins/log.rb', line 312
def sync=(val)
@orig.sync = val if @orig.respond_to?(:sync=)
val
end
|
#to_io ⇒ Object
317
318
319
|
# File 'lib/pwn/plugins/log.rb', line 317
def to_io
@orig.respond_to?(:to_io) ? @orig.to_io : @orig
end
|
#tty? ⇒ Boolean
292
293
294
|
# File 'lib/pwn/plugins/log.rb', line 292
def tty?
@orig.respond_to?(:tty?) && @orig.tty?
end
|
#write(*args) ⇒ Object
257
258
259
260
261
262
263
264
265
266
|
# File 'lib/pwn/plugins/log.rb', line 257
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
|