Terminal: Open a new pane with the environment vars of the parent

Created on 16 Jan 2020  路  7Comments  路  Source: microsoft/terminal

Just chiming in;

_ (profile,working dir, environment var, etc)._

Anything about the _actual process_ on the other end is, in the general case, impossible to replicate. The connected process could be ssh.exe, whose environment variables and working directory have no bearing on the detectable environment and working directory from the terminal side. The same actually, weirdly enough, applies to WSL. It doesn't use "working directory" and it doesn't expose its environment variables to interested Windows processes in any way.
Powershell doesn't even _set_ the current working directory, so its directory can't be detected (!) either.

Was interested in this but seems like it's not going to happen. Just curious if something like 'start' in cmd can't work in terminal. Is this the case ?

@zadjii-msft I'm trying to clone the current terminal into a new pane. I need the same environment var's etc carried over similar to how 'start' does it in cmd. I know it isn't currently possible but is there a temporary workaround?

_Originally posted by @Surya-06 in https://github.com/microsoft/terminal/issues/1756#issuecomment-575134471_

Area-Settings Issue-Task Priority-3 Product-Terminal

Most helpful comment

@piotrpalek You're going to want to take a look at #3158

All 7 comments

I'm pulling Triage, but this might not be possible.

@zadjii-msft @DHowett-MSFT Now that the duplicate pane option is in, do you guys think it's possible to get the env vars from that pane ? If so I'd really like to help with it cause it's particularly a pain point for me. Let me know if I can help. Thanks !

I honestly don't think it's possible to get the environment variables of a child process trivially. Plus, if there's a whole tree of processes running in a tab, then which process's environment variables should be the ones duplicated? I'd reckon that this counts as a _hard_ problem

Yes, it doesn't seem pretty straight forward to bring the env vars from another process and set them here but I'm seriously interested in making this happen cause this would be a unique thing in Terminal different from every other application. If you can give me some pointers I would at least like to explore the possibility. I also think this isn't so walled off since conemu does it ( duplicate root process option). This integrated with duplicate tab would seriously make duplication more useful. Thoughts ? @zadjii-msft

I also just realized another alternative, can we allow users to configure env vars when opening profiles. This will allow them to set the vars and just duplicate the profile and everything should still be fine right ?

Hey I've found this issue because I was searching for the following: I'm not sure how it's for other people, but for me 99% of what I want is to have the split open the same shell in the current path I'm in, would that be something that's doable?

I know there's a PR already in the works for opening a split with the current shell, what about the path?

@piotrpalek You're going to want to take a look at #3158

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghvanderweg picture ghvanderweg  路  3Comments

DieselMeister picture DieselMeister  路  3Comments

NickITGuy picture NickITGuy  路  3Comments

wkbrd picture wkbrd  路  3Comments

mrmlnc picture mrmlnc  路  3Comments