Skip to content

Commit 6979f20

Browse files
committed
extmod/os_dupterm: Call stream ioctl for repl attach/detach.
Signed-off-by: Andrew Leech <[email protected]>
1 parent e949446 commit 6979f20

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

extmod/os_dupterm.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ void mp_os_deactivate(size_t dupterm_idx, const char *msg, mp_obj_t exc) {
5252
nlr_buf_t nlr;
5353
if (nlr_push(&nlr) == 0) {
5454
mp_stream_close(term);
55+
const mp_stream_p_t *stream_p = mp_get_stream_raise(term, MP_STREAM_OP_IOCTL);
56+
stream_p->ioctl(term, MP_STREAM_REPL_ATTACHED, 0, &errcode);
5557
nlr_pop();
5658
} else {
5759
// Ignore any errors during stream closing
@@ -227,7 +229,7 @@ static mp_obj_t mp_os_dupterm(size_t n_args, const mp_obj_t *args) {
227229
if (previous_obj == MP_OBJ_NULL) {
228230
previous_obj = mp_const_none;
229231
} else {
230-
const mp_stream_p_t *stream_p = mp_get_stream(previous_obj, MP_STREAM_OP_IOCTL);
232+
const mp_stream_p_t *stream_p = mp_get_stream_raise(previous_obj, MP_STREAM_OP_IOCTL);
231233
stream_p->ioctl(previous_obj, MP_STREAM_REPL_ATTACHED, 0, &errcode);
232234
}
233235
if (args[0] == mp_const_none) {

0 commit comments

Comments
 (0)