Show More
@@ -39,15 +39,19 b' def with_output(method):' | |||||
39 | """method decorator for ensuring output is handled properly in a message handler |
|
39 | """method decorator for ensuring output is handled properly in a message handler | |
40 |
|
40 | |||
41 | - sets parent header before entering the method |
|
41 | - sets parent header before entering the method | |
|
42 | - publishes busy/idle | |||
42 | - flushes stdout/stderr after |
|
43 | - flushes stdout/stderr after | |
43 | """ |
|
44 | """ | |
44 | def method_with_output(self, stream, ident, msg): |
|
45 | def method_with_output(self, stream, ident, msg): | |
45 |
|
|
46 | parent = msg['header'] | |
|
47 | self.shell.set_parent(parent) | |||
|
48 | self.shell.kernel._publish_status('busy') | |||
46 | try: |
|
49 | try: | |
47 | return method(self, stream, ident, msg) |
|
50 | return method(self, stream, ident, msg) | |
48 | finally: |
|
51 | finally: | |
49 | sys.stdout.flush() |
|
52 | sys.stdout.flush() | |
50 | sys.stderr.flush() |
|
53 | sys.stderr.flush() | |
|
54 | self.shell.kernel._publish_status('idle') | |||
51 |
|
55 | |||
52 | return method_with_output |
|
56 | return method_with_output | |
53 |
|
57 |
General Comments 0
You need to be logged in to leave comments.
Login now