Module: NewRelic::Security::Instrumentation::PTY::Chain

Defined in:
lib/newrelic_security/instrumentation-security/pty/chain.rb

Class Method Summary collapse

Class Method Details

.instrument!Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/newrelic_security/instrumentation-security/pty/chain.rb', line 5

def self.instrument!
  ::PTY.class_eval do
    class << self
      include NewRelic::Security::Instrumentation::PTY

      alias_method :spawn_without_security, :spawn

      def spawn(*var)
        retval = nil
        event = spawn_on_enter(*var) { retval = spawn_without_security(*var) }
        spawn_on_exit(event) { return retval }
      end

      alias_method :getpty_without_security, :getpty

      def getpty(*var, &block)
        retval = nil
        event = getpty_on_enter(*var) { retval = getpty_without_security(*var, &block) }
        getpty_on_exit(event) { return retval }
      end
    end
  end
end