~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/strace.py

  • Committer: Martin von Gagern
  • Date: 2011-06-01 12:53:56 UTC
  • mto: This revision was merged to the branch mainline in revision 6009.
  • Revision ID: martin.vgagern@gmx.net-20110601125356-lwozv2vecea6hxfz
Change from no_decorate to classify as name for the argument.

The command line switch remains as --no-classify, to keep backwards
compatibility.  Users are free to include --no-classify in an alias, and
still use --classify to change back.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
# this is currently test-focused, so importing bzrlib.tests is ok. We might
30
30
# want to move feature to its own module though.
31
 
from bzrlib.tests.features import Feature
 
31
from bzrlib.tests import Feature
32
32
 
33
33
 
34
34
def strace(function, *args, **kwargs):
98
98
        self.err_messages = err_messages
99
99
 
100
100
 
 
101
class _StraceFeature(Feature):
 
102
 
 
103
    def _probe(self):
 
104
        try:
 
105
            proc = subprocess.Popen(['strace'],
 
106
                stderr=subprocess.PIPE,
 
107
                stdout=subprocess.PIPE)
 
108
            proc.communicate()
 
109
            return True
 
110
        except OSError, e:
 
111
            if e.errno == errno.ENOENT:
 
112
                # strace is not installed
 
113
                return False
 
114
            else:
 
115
                raise
 
116
 
 
117
    def feature_name(self):
 
118
        return 'strace'
 
119
 
 
120
StraceFeature = _StraceFeature()