-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to rename session #57
Comments
I think there are a few different issues we need to address to do this well What do we do if the target session name already existsI think by default, we should exit with an error, but let people override the behavior with What do we do about SHPOOL_SESSION_NAMEThe SHPOOL_SESSION_NAME env var is used by the We could inject a One option that has been in the back of my mind for a while, is making an LD_PRELOAD shim that we can inject into child shells to let us change environment variables. I believe that as long as we call |
These are complicated issues I hadn't thought of. I don't fully understand your last paragraph, but what if the mechanism to get the session name was changed? Something like running |
In terms of my last paragraph, I just wrote a bit more about what I mean in the chook placeholder crate that I just made. For now, I don't have any code, but I think this should be possible through a combination of defining a custom I think There are two issues I see with the
Potentially we could do something like cache the name in a file, but it's not clear to me that that would be much better. It would still be IO on the same host. I think I'm going to play with |
I took a swing at chook, and I don't know that it can be reasonably implemented as a rust crate. The problem is that rust doesn't really want any code running before main, so you can't really use the stdlib. This is a pain for both the little RPC code I wrote and also for the user provided function. This was my first swing at it, but I never really got it working. Also, I didn't get to the point of trying to use it before deciding that this is probably untenable, but rust-ctor looks like a useful crate for this if I ever decide to pick it back up. I'm now thinking that making a more focused |
I just posted a working inject-env crate: https://github.com/shell-pool/subprocess-inject-env Fortunately it was a lot easier to get working when the shim is written in C rather than rust (I could probably have managed with rust, but C seems a bit simpler since I don't need a seperate shim crate and it doesn't seem worth it if users can't write their own custom stub handler to be injected in the target). Once I get it reviewed and the various CI toil done I'll cut a release and then I can integrate the crate with shpool proper and use it to take on this actual request. Mac does not support LD_PRELOAD natively, but it looks like there might be an equivilent we can use, so hopefully it will be possible to port to mac as well since the goal is to get shpool working on mac at some point. |
Seems like zsh and fish cache their environment variables, which is pretty annoying. We might not be able to use the inject-env crate |
Oof, that's a pity. I'm a zsh user. |
I think it just means we need to consider the id and subcommand based approach to session name resolution since that will definitely work regardless of shell. |
As much as I like doing cursed systems things, it seems like env var injection is not gonna work because zsh and fish want to be efficient or something annoying like that, so we have to do the id based approach. I think this is a general sketch of what we want to do
possibly (not sure if this will work, but it could help avoid a bunch of RPCs if it does):
|
I ran into a need to rename a (long-running) session. It would be great if there was a
shpool rename old new
command.The text was updated successfully, but these errors were encountered: