oswitch icon indicating copy to clipboard operation
oswitch copied to clipboard

when exiting, `pwd` should be transferred

Open yannickwurm opened this issue 10 years ago • 1 comments

currently you end up back where switch was launched

yannickwurm avatar Jan 12 '15 19:01 yannickwurm

It's going to be a highly contrived solution, if at all possible.

Your shell starts switch (which is a Ruby process). Switch execs docker run. exec overwrites the current process with new process, keeping the same pid.

shell -> (ruby) -> docker

docker runs your shell or the given command as a separate process within container. switch biolinux will look like:

sudo [pid 1] -> bash [some pid]

Either on host, or in container I can get the cwd of current process by readlink /proc/<pid>/cwd (on Linux; using lsof on Mac). But there's no real way for the owner process (your shell) on host to get cwd of the shell running within the container. Either way, I don't see how to use that to set parent shell's cwd.


I would rather you see switch as similar to "opening a new tab". Changes done in new tab don't cause any changes in other tabs. If no, it should be possible to have container print cwd to console on quit. Then you can copy paste the path and cd yourself, or run switch as cd $(switch bioilinux).

yeban avatar Jan 13 '15 09:01 yeban