File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -3844,6 +3844,21 @@ adds a new query option to the :mfcmd:`module-info` modulefile command:
38443844 }
38453845 }
38463846
3847+ If a hook procedure needs to execute modulefile commands (for example, to
3848+ define environment variables), these commands should be run through the
3849+ current modulefile Tcl interpreter. This ensures that the commands behave
3850+ consistently with the current modulefile evaluation mode.
3851+
3852+ .. code-block :: tcl
3853+
3854+ proc hook_procedure {value} {
3855+ # get the name of the current modulefile Tcl interpreter
3856+ set modfile_interp [getCurrentModfileInterpName]
3857+
3858+ # execute a modulefile command in the current interpreter context
3859+ interp eval $modfile_interp setenv MYVAR $value
3860+ }
3861+
38473862 Siteconfig hook variables
38483863"""""""""""""""""""""""""
38493864
You can’t perform that action at this time.
0 commit comments