Changeset 943 in tailor


Ignore:
Timestamp:
10/20/05 02:30:41 (8 years ago)
Author:
lele@…
Hash name:
20051020003041-97f81-c5f28be1d46fddd957202e3edaf15b2a306095ae
Message:

Nicer log for the shell command

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vcpx/shwrap.py

    r940 r943  
    7676 
    7777    def __str__(self): 
     78        r = '$'+repr(self) 
     79        if self.cwd: 
     80            r = self.cwd + ' ' + r 
     81        return r 
     82 
     83    def __repr__(self): 
    7884        result = [] 
    79         if self.cwd: 
    80             result.append(self.cwd) 
    81             result.append(' ') 
    82         result.append('$') 
    8385        needquote = False 
    8486        for arg in self._last_command or self.command: 
     
    123125        from sys import stderr 
    124126        from locale import getpreferredencoding 
    125         import os 
     127        from os import environ, getcwd 
    126128        from cStringIO import StringIO 
    127129 
     
    142144            kwargs['cwd'] = self.cwd 
    143145 
     146        self.log.debug("Executing %r (%r)", self, kwargs.get('cwd', getcwd())) 
     147 
    144148        if not kwargs.has_key('env'): 
    145149            env = kwargs['env'] = {} 
    146             env.update(os.environ) 
     150            env.update(environ) 
    147151 
    148152            for v in ['LANG', 'TZ', 'PATH']: 
     
    157161        # when the caller didn't ask for them. 
    158162        if not self.DEBUG: 
    159             devnull = getattr(os, 'devnull', '/dev/null') 
     163            try: 
     164                from os import devnull 
     165            except ImportError: 
     166                devnull = '/dev/null' 
    160167            if output is None: 
    161168                output = open(devnull, 'w') 
Note: See TracChangeset for help on using the changeset viewer.