1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to? Environment Variables changed

Discussion in 'Support' started by fpefpe, Sep 14, 2012.

  1. fpefpe

    Joined:
    Oct 18, 2008
    Messages:
    238
    Likes Received:
    1
    Hello

    For the past day or so I been trying to track down an issue that does not seems to make any sense.

    I just set up the git / shell environment – for the most part it seems like a collection of commands cobbled together with the bash shell

    the shortcut to run the bash shell is

    c:\windows\system32\cmd.exe /c ""c:\program files\git\bin\sh.exe" --login -i"

    I also put this text into a btm file to I could run it from the tcmd / tcc

    It seem to work ok – I would run the btm and a bash shell would start up and now having scope in my tcmd/tcc window.

    I would run some command and also specify the (full) path to the windows editor that I use. It all seems to work ok. I then exited out of the git /sh and nothing I was typing at the tcc prompt was working. – It turns out that my path and pathenv vars reverted back to what they were before tcstart ran I have changes in the path (and pathext) each time tcstart runs. What is even more bizarre is that I had multiple tcc tabs open and they all were changed in the same way.

    I tried everything I could think of – I used the “start” command, I uses “setlocal” and “endlocal” but nothing seemed to work.

    The only thing that make any kind of sense is that bash shell is hacking with the internal pointer to the env block – this makes some what sense, since the way env vars in BASH are in unix format, ie

    /c/program files/mystuff:/c/foo

    not

    c:\program files\mystuff;c:\foo


    and I could see hacking with the pointer would make somewhat sense since the code would have to toggle back-and-forth when ever a command is executed from within bash

    Has anyone seen this before?
     
  2. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,785
    Likes Received:
    29
    1. Why are you using CMD to start bash? Your CMD is doing nothing but sit there until you exit bash ... then, because of the "/c", CMD exits. It would seem better to just execute (shortcut or BTM file)
    Code:
    "c:\program files\git\bin\sh.exe" --login -i
    2. Every process (EXE) has it's own environment (or environment block, as you put it). It is quite difficult for an app (bash) to alter the environment of another app (say its parent or grandparent). That requires injecting code into the other app and I'm rather confident bash doesn't do that.

    I suggest you get CMD out of the picture and see how it works then.
     
  3. fpefpe

    Joined:
    Oct 18, 2008
    Messages:
    238
    Likes Received:
    1
    I did remove cmd.exe and just executed the sh.exe directly ... but the condition still the same --- I am now trying a "start" cmd -- at first when I did this, i used the "/b" option -- this time I am going have it create a new window -- I still content there is some trickery with the env pointers -- the env vars were still changed even with the sequence

    setlocal
    sh.exe
    endlocal
     

Share This Page