]> SALOME platform Git repositories - modules/kernel.git/blob - bin/server.py
Salome HOME
Merging from V3_2_6pre4
[modules/kernel.git] / bin / server.py
1 #!/usr/bin/env python
2
3 import os, sys, string
4 process_id = {}
5
6 # -----------------------------------------------------------------------------
7 #
8 # Definition des classes d'objets pour le lancement des Server CORBA
9 #
10
11 class Server:
12     """Generic class for CORBA server launch"""
13
14     def initArgs(self):
15         self.PID=None
16         self.CMD=[]
17         self.ARGS=[]    
18         if self.args['xterm']:
19             self.ARGS=['xterm', '-iconic', '-sb', '-sl', '500', '-hold']
20
21     def __init__(self,args):
22         self.args=args
23         self.initArgs()
24
25
26     def run(self):
27         global process_id
28         myargs=self.ARGS
29         if self.args['xterm']:
30             # (Debian) send LD_LIBRARY_PATH to children shells (xterm)
31             env_ld_library_path=['env', 'LD_LIBRARY_PATH='
32                                  + os.getenv("LD_LIBRARY_PATH")]
33             myargs = myargs +['-T']+self.CMD[:1]+['-e'] + env_ld_library_path
34         command = myargs + self.CMD
35         print "command = ", command
36         if sys.platform == "win32":
37           import win32pm
38           #cmd_str = "\"" + string.join(command, " ") + "\""
39           #print cmd_str
40           #pid = win32pm.spawnpid( cmd_str )
41           pid = win32pm.spawnpid( string.join(command, " "), '-nc' )
42           #pid = win32pm.spawnpid( string.join(command, " ") )
43         else:
44           pid = os.spawnvp(os.P_NOWAIT, command[0], command)
45         process_id[pid]=self.CMD
46         self.PID = pid