Skip to content
This repository has been archived by the owner on Jan 1, 2024. It is now read-only.

unset env variables when session is closed #47

Open
basbebe opened this issue Feb 2, 2021 · 11 comments
Open

unset env variables when session is closed #47

basbebe opened this issue Feb 2, 2021 · 11 comments

Comments

@basbebe
Copy link
Contributor

basbebe commented Feb 2, 2021

After unsuccesfully trying to reattach to a session, environment variables should be unset I guess.

@alexherbo2
Copy link
Collaborator

How?

@basbebe
Copy link
Contributor Author

basbebe commented Feb 2, 2021

something like

:attach

#!/bin/sh

# Reattach to the session.
kak -c "$KAKOUNE_SESSION" "$@"

exit_status=$?
if [ $exit_status -ne 0 ] ; then
    unset IN_KAKOUNE_CONNECT
    unset KAKOUNE_SESSION
    unset KAKOUNE_CLIENT
fi

(maybe in an extra function – sorry for not opening a PR)

@basbebe
Copy link
Contributor Author

basbebe commented Feb 2, 2021

or even

exit_status=$?
if [ $exit_status -ne 0 ] ; then
    exit
fi

@basbebe
Copy link
Contributor Author

basbebe commented Feb 3, 2021

probably a :quit function would be a good approach (with alias q)?

and in each function:

exit_status=$?
if [ $exit_status -ne 0 ] ; then
    :quit
fi

@basbebe
Copy link
Contributor Author

basbebe commented Feb 3, 2021

different but related (open new issue or put to trash?):

If a session is killed, kill all related windows:

  • that :nnn that is still open? kill it (pid needs to be remembered)
  • that kak-shell that is still open? exit it

@alexherbo2
Copy link
Collaborator

I remember @occivink telling the underlying terminal used in the terminal alias doesn’t necessarily expose a PID.

@basbebe
Copy link
Contributor Author

basbebe commented Feb 4, 2021

I remember @occivink telling the underlying terminal used in the terminal alias doesn’t necessarily expose a PID.

then what I had in mind would of course not be feasible without the overhead of loops and hooks or environment variables storing the PIDs.

but nevertheless I would find a :quit function useful which would automatically be invoked when the session is lost.

@alexherbo2
Copy link
Collaborator

What is the content of the :quit command?

@basbebe
Copy link
Contributor Author

basbebe commented Feb 4, 2021

probably just exit.

maybe also a :kill which does :send kill?

But of course both are not necessary for functionality.

@alexherbo2
Copy link
Collaborator

alexherbo2 commented Feb 4, 2021

How about @ aliased to :send, so that you can:

@ kill

@basbebe
Copy link
Contributor Author

basbebe commented Feb 4, 2021

@ kill

great!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants