aboutsummaryrefslogtreecommitdiff
blob: 1c72279f1c5159c8dc634a86b78576d2b7577150 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python2

import os
import sys

class logger:
  socketname=''
  hooklibpath='/home/bay/gsoc/src/hook_lib/file_hook.so' # TODO: change
  
  def __init__(self,socketname):
	self.socketname=socketname
	
  def execprog(self,prog_name,arguments):
	try:
	  env=os.environ.copy()
	  env["LD_PRELOAD"]=self.hooklibpath
	  env["LOG_SOCKET"]=self.socketname
	  
	  os.execvpe(prog_name, arguments, env)
	except OSError, e:
	  print "Failed to launch the programm: %s" % e
	  sys.exit(1)