~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/stub_sftp.py

  • Committer: Martin
  • Date: 2010-05-16 15:18:43 UTC
  • mfrom: (5235 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5239.
  • Revision ID: gzlist@googlemail.com-20100516151843-lu53u7caehm3ie3i
Merge bzr.dev to resolve conflicts in NEWS and _chk_map_pyx

Show diffs side-by-side

added added

removed removed

Lines of Context:
283
283
        self._socket.close()
284
284
 
285
285
    def run(self):
 
286
        trace.mutter('SocketListener %r has started', self)
286
287
        while True:
287
288
            readable, writable_unused, exception_unused = \
288
289
                select.select([self._socket], [], [], 0.1)
289
290
            if self._stop_event.isSet():
 
291
                trace.mutter('SocketListener %r has stopped', self)
290
292
                return
291
293
            if len(readable) == 0:
292
294
                continue
293
295
            try:
294
296
                s, addr_unused = self._socket.accept()
 
297
                trace.mutter('SocketListener %r has accepted connection %r',
 
298
                    self, s)
295
299
                # because the loopback socket is inline, and transports are
296
300
                # never explicitly closed, best to launch a new thread.
297
301
                threading.Thread(target=self._callback, args=(s,)).start()
442
446
                'the local current working directory.' % (backing_server,))
443
447
        self._original_vendor = ssh._ssh_vendor_manager._cached_ssh_vendor
444
448
        ssh._ssh_vendor_manager._cached_ssh_vendor = self._vendor
445
 
        # FIXME: the following block should certainly just be self._homedir =
446
 
        # osutils.getcwd() but that fails badly on Unix -- vila 20100224
447
449
        if sys.platform == 'win32':
448
450
            # Win32 needs to use the UNICODE api
449
451
            self._homedir = os.getcwdu()
 
452
            # Normalize the path or it will be wrongly escaped
 
453
            self._homedir = osutils.normpath(self._homedir)
450
454
        else:
451
455
            # But Linux SFTP servers should just deal in bytestreams
452
456
            self._homedir = os.getcwd()