1.5.12: TERM environment reset to "cygwin" after fork()

Richard Campbell richard.campbell@air2web.com
Fri Dec 3 21:44:00 GMT 2004


>Provide a simple test case, that is compilable and linkable so that
>we can investigate your claim.

#include <stdio.h>

int main(int argc, char **argv)
{
   setenv("TERM", "ansi", 1);
    /* ... blah, blah, ... */
    printf("TERM is: %s\n", getenv("TERM"));  /* prints "ansi" as expected */
    int i = fork();
    if (i < 0)
        printf("Bad Business...");
    else if ( i > 0 )
        printf("parent TERM is: %s\n", getenv("TERM")); 
    else
        printf("child  TERM is: %s\n", getenv("TERM")); 
}

C:\dl>a.exe
TERM is: ansi
parent TERM is: ansi
child  TERM is: cygwin

C:\dl>

campbe_r@washington $ ./a.exe 
TERM is: ansi
parent TERM is: ansi
child  TERM is: ansi
campbe_r@washington $ 

Not sure why it would give different results from cmd.exe and from bash.

cygcheck -s output attached, but it's a windows 2000 machine with sp 4, 
cygwin 1.5.12, gcc 3.3.3.

-Richard Campbell.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: application/octet-stream
Size: 33782 bytes
Desc: cygcheck.out
URL: <http://cygwin.com/pipermail/cygwin/attachments/20041203/d49cc4a9/attachment.obj>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list