SPONSORS:






User Tag List

Results 1 to 4 of 4
  1. #1
    Senior Member
    Join Date
    Jul 2000
    Posts
    117
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Sys_SetEnv not working correctly

    The short answer is, no, you're not doing anything "wrong" ...

    The thing is, environments only pass from parent to child, and not the other way. You would see this same thing is you wrote a simple C program that sets / gets an env var and prints it. The calling shell (DOS) environment is "untouched".

    Basically, when you call "start", you're invoking a new (child) shell within which Silk executes (and changes environment settings). Once Silk exits, that child shell is gone, and you're back in the parent again -- where the value is as it always was.

    Hope that helps clarify things a bit ...

    ------------------

  2. #2
    Senior Member
    Join Date
    Apr 2001
    Location
    San Diego,CA,USA
    Posts
    108
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Sys_SetEnv not working correctly

    thanks I really helped. originally it was my haunch that start might have been starting a new command environment but I wasn't sure. thatnks much!!

    Question still remains

    but how does one achieve what I am trying to do? is there anyway to pass a message or something to the parent thread?

    I just need a flag to be set or unset in the parent thread

    ------------------

  3. #3
    Senior Member
    Join Date
    Jul 2000
    Posts
    117
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Sys_SetEnv not working correctly

    The easiest (pretty much the only) way is for the child to write data to a file (a semaphore) that the parent could then read and interpret.

    ------------------

  4. #4
    Senior Member
    Join Date
    Apr 2001
    Location
    San Diego,CA,USA
    Posts
    108
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Sys_SetEnv not working correctly

    I have a batch file which set an environment variable (set MyEnvVar=1)the same batch file invokes silk and runs one test in which I access that env variable by SYS_GetEnv("MyEnvVar")
    it gets the value of the variable fine (1)but when I do SYS_SetEnv("MyEnvVar","2")
    then I quit silk from the batch file and do a 'set' in the dos window the value of the MyEnvVar is still 1 and has not changed to 2
    but the printed value in silk (Print(Sys_GetEnv("MyEnvVar"))) is 2

    Where is silk changing the value shouldn't it get reflected in the dos window too?
    *******************
    batch file:
    set MyEnvVar=1
    start /wait partner -q -resexport -r testEnv.t

    set
    pause
    ***********************
    testenv.t
    main()
    test()

    testcase test() appstate none
    [ ] print("'{SYS_GetEnv("MyEnvVar")}'")
    [ ] SYS_SetEnv("MyEnvVar","2")
    [ ] print("'{SYS_GetEnv("MyEnvVar")}'")
    ***********************************

    Am I doing anything wrong here?



    ------------------

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 03:47 PM.

Copyright BetaSoft Inc.