You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When resuming from SIGSTOP, events aren't processed right / stdin isn't attached the same way?
So, for example, when you watch for events, CTRL-C, CTRL-Z don't work.. CTRL Z which sends SIGSTOP doesn't work - no problem, we just listen for CTRL-Z and send our own SIGSTOP message to our own PID to keep this functionality and we can even do some cleanup in our event handler.
Now, the issue appears when you resume the program - it DOES still listen for events, however it's like it's not attached/focused completely - CTRL-C and CTRL-Z will actually send their signals now. Other key events, you have to press ENTER for them to be picked up now - but they do still get picked up, even without re-assigning them.
I've tried just about everything, realloc(), program.listen(). It's like we need to reattach to stdin or something - except, as I said it does still process events, you just have to press enter after the keypress. Say you bind an event to 'x', press 'x' twice and hit enter, your event fires twice. The event should fire without pressing enter.
It's as if we're either setting a mode or changing how we read stdin or input at some point, I've been digging to try and find out where so I can either duplicate it in my own code or modify blessed to account for the reattachment.
Here's a testcase. Run it, pressing 'x' runs the event. Then press CTRL-Z, which runs the CTRL-Z event. You can see in this last example I even tried removing and resetting all handlers.
The ONLY way I've been able to get it to work is by doing program.destroy() and starting over, but then I would have to redraw all my windows/state/etc.
`#!/usr/bin/env node
"use strict";
const blessed = require('neo-blessed'),
program = blessed.program();
When resuming from SIGSTOP, events aren't processed right / stdin isn't attached the same way?
So, for example, when you watch for events, CTRL-C, CTRL-Z don't work.. CTRL Z which sends SIGSTOP doesn't work - no problem, we just listen for CTRL-Z and send our own SIGSTOP message to our own PID to keep this functionality and we can even do some cleanup in our event handler.
Now, the issue appears when you resume the program - it DOES still listen for events, however it's like it's not attached/focused completely - CTRL-C and CTRL-Z will actually send their signals now. Other key events, you have to press ENTER for them to be picked up now - but they do still get picked up, even without re-assigning them.
I've tried just about everything, realloc(), program.listen(). It's like we need to reattach to stdin or something - except, as I said it does still process events, you just have to press enter after the keypress. Say you bind an event to 'x', press 'x' twice and hit enter, your event fires twice. The event should fire without pressing enter.
It's as if we're either setting a mode or changing how we read stdin or input at some point, I've been digging to try and find out where so I can either duplicate it in my own code or modify blessed to account for the reattachment.
Here's a testcase. Run it, pressing 'x' runs the event. Then press CTRL-Z, which runs the CTRL-Z event. You can see in this last example I even tried removing and resetting all handlers.
The ONLY way I've been able to get it to work is by doing program.destroy() and starting over, but then I would have to redraw all my windows/state/etc.
`#!/usr/bin/env node
"use strict";
const blessed = require('neo-blessed'),
program = blessed.program();
const screen = blessed.screen({
smartCSR: true
});
function setupHandlers() {
screen.key(['x'], (ch,key)=> {
console.log('xevent:');
console.log(ch);
console.log(key);
});
screen.key(['C-z'], (ch,key)=>{
console.log('stopevent- do cleanup here');
// screen.unkey(['x']);
// screen.unkey(['C-z']);
console.log(ch);
console.log(key);
process.kill(process.pid,'SIGSTOP');
});
}
setupHandlers();
program.hideCursor();
process.on('SIGCONT',(ev) => {
console.log(ev)
// setupHandlers();
// screen.enableInput();
// screen.realloc();
});
`
The text was updated successfully, but these errors were encountered: