##// END OF EJS Templates
profile: use explicit logic to control file closing...
marmoute -
r32805:2b0fc568 default
parent child Browse files
Show More
@@ -151,6 +151,7 class profile(object):
151 self._ui = ui
151 self._ui = ui
152 self._output = None
152 self._output = None
153 self._fp = None
153 self._fp = None
154 self._fpdoclose = True
154 self._profiler = None
155 self._profiler = None
155 self._enabled = enabled
156 self._enabled = enabled
156 self._entered = False
157 self._entered = False
@@ -193,6 +194,7 class profile(object):
193 path = self._ui.expandpath(self._output)
194 path = self._ui.expandpath(self._output)
194 self._fp = open(path, 'wb')
195 self._fp = open(path, 'wb')
195 else:
196 else:
197 self._fpdoclose = False
196 self._fp = self._ui.ferr
198 self._fp = self._ui.ferr
197
199
198 if proffn is not None:
200 if proffn is not None:
@@ -221,4 +223,5 class profile(object):
221 self._closefp()
223 self._closefp()
222
224
223 def _closefp(self):
225 def _closefp(self):
226 if self._fpdoclose and self._fp is not None:
224 self._fp.close()
227 self._fp.close()
General Comments 0
You need to be logged in to leave comments. Login now