MCPcopy
hub / github.com/amoffat/sh / close

Method close

src/sh/__init__.py:3042–3053  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3040 return True
3041
3042 def close(self):
3043 self.log.debug("closing, but flushing first")
3044 chunk = self.stream_bufferer.flush()
3045 self.log.debug("got chunk size %d to flush: %r", len(chunk), chunk[:30])
3046 try:
3047 if chunk:
3048 os.write(self.stream, chunk)
3049
3050 except OSError:
3051 pass
3052
3053 os.close(self.stream)
3054
3055
3056def determine_how_to_feed_output(handler, encoding, decode_errors):

Callers 15

__init__Method · 0.45
_process_just_endedMethod · 0.45
input_threadFunction · 0.45
output_threadFunction · 0.45
closeMethod · 0.45
test_no_close_fdsMethod · 0.45
test_close_fdsMethod · 0.45
test_pass_fdsMethod · 0.45
test_out_redirectionMethod · 0.45
test_err_redirectionMethod · 0.45
test_tty_teeMethod · 0.45

Calls 3

debugMethod · 0.80
flushMethod · 0.80
writeMethod · 0.80

Tested by 10

test_no_close_fdsMethod · 0.36
test_close_fdsMethod · 0.36
test_pass_fdsMethod · 0.36
test_out_redirectionMethod · 0.36
test_err_redirectionMethod · 0.36
test_tty_teeMethod · 0.36
test_fd_over_1024Method · 0.36
test_unicode_pathMethod · 0.36