Closed naquiroz closed 3 months ago
for what it's worth, you can achieve this with a custom profile in your terminal:
I already tried that. It generates a session within a session of the terminal. You can exit twice.
guess it depends on the terminal emulator. mine closes on the first exit.
@naquiroz Would you be interested in contributing the feature?
I think we could add something like a flag --parent-term-exit
that will update the exit code to terminate the parent ppid which is either another shell or worst case the terminal emulator of the shell.
I would love to but I lack skills on such low level coding. I'll look at the code and see if I can manage.
Ok, I think I can do it. But how would I get the parent (if any) id?
Would something like this work?
term.onExit(({ exitCode }) => {
if (process.ppid) {
process.kill(process.ppid);
}
process.exit(exitCode);
});
Would something like this work?
term.onExit(({ exitCode }) => { if (process.ppid) { process.kill(process.ppid); } process.exit(exitCode); });
This is looking great so far! Why don't we check for a commander flag instead of if the ppid exists (since for our use case we know it will always exist), because we want users to be able to opt in for this.
You could add the option to the type here and add the flag itself here like we for the other options
Then we could update the above code to be
term.onExit(({ exitCode }) => {
if (parentTermExit) {
process.kill(process.ppid);
}
process.exit(exitCode);
});
Done! (I think)
Is it release automatically?
No I have to create a manual release. I'll most likely be Monday with a fix for #205
Is your feature request related to a problem? Please describe. I want to open a terminal and have the inshellisense already running. Currently if I add
is
to my bashrc, I can exit from the terminal twice, becauseis
generates a new shell.Describe the solution you'd like A command to silently start in the same shell, the ishellisense.
Describe alternatives you've considered I've tried adding
is
to the ~/.zshrc, but it doesn't work in an optimal way.Additional context Add any other context or screenshots about the feature request here.