Changeset 1566

Show
Ignore:
Timestamp:
11/18/08 14:22:16 (2 months ago)
Author:
astormont
Message:

Wine-Doors now uses pgrep instead of ps, improves solaris compat

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • wine-doors/trunk/setup.py

    r1562 r1566  
    176176            print "Not found !" 
    177177 
    178         print "  ps . . . ", 
    179         if findexec( "ps" ): 
     178        print "  pgrep . . . ", 
     179        if findexec( "pgrep" ): 
    180180            print "Found" 
    181181        else: 
  • wine-doors/trunk/src/wine.py

    r1549 r1566  
    2525 
    2626    def SetColoursFromGtk( self ): 
     27         
    2728        import winethemefromgtk 
    2829        del winethemefromgtk 
     
    140141    def CountInstances( self, process_name="wine" ): 
    141142        log.Debug( "Counting instances of " + process_name ) 
    142         ps = subprocess.Popen( ["ps", "xwww"], stdout=PIPE ) 
    143         gp = subprocess.Popen( ["grep", process_name], stdin=ps.stdout, stdout=PIPE ) 
    144         gg = subprocess.Popen( ["grep", "-v", "grep"], stdin=gp.stdout, stdout=PIPE ) 
    145         gs = subprocess.Popen( ["grep", "-v", "python"], stdin=gg.stdout, stdout=PIPE ) 
    146         wc = subprocess.Popen( ["wc", "-l"], stdin=gs.stdout, stdout=PIPE ) 
    147         processes = wc.communicate()[0] 
    148         processes = processes.rstrip() 
    149         log.Debug( "Found "+ processes+" " + process_name + "processes active" ) 
    150         processes = int( processes ) 
     143 
     144        pgrep = commands.getoutput( "pgrep -l %s" % process_name ) 
     145        processes = 0 
     146        for item in pgrep.split("\n"): 
     147            if not item.find( "python" ): 
     148                processes += 1 
     149 
     150        log.Debug( "Found %i %s processes active" % ( processes, process_name ) ) 
    151151 
    152152        return processes