mirror of
https://github.com/envmodules/modules.git
synced 2026-06-10 00:56:30 +08:00
Supersede 'puts' command to catch content sent to stdout within modulefile in order to postpone content channel send after rendering on stdout the relative environment changes required by the modulefile. By doing so, environment variable set within modulefile will be available when outputing directly command to the stdout channel. A 'putsModfileCmd' procedure is added to catch all 'puts' call in a modulefile interpretation. This procedure analyzes if the puts command targets the stdout channel. If so, command argument is saved in a 'g_stdoutPuts' global list to be then processed during renderSettings. If no, the real puts is called (for stderr send for instance). Add 50-cmds/310-puts non-regression tests to garanty all kind of puts command are well processed. Closes #113
44 lines
938 B
Plaintext
44 lines
938 B
Plaintext
#%Module1.0
|
|
|
|
##############################################################################
|
|
# Modules Revision 3.0
|
|
# Providing a flexible user environment
|
|
#
|
|
# File: puts/%M%
|
|
# Revision: %I%
|
|
# First Edition: 2017/11/23
|
|
# Last Mod.: %U%, %G%
|
|
#
|
|
# Authors: Xavier Delaruelle, xavier.delaruelle@cea.fr
|
|
#
|
|
# Description: Testuite modulefile
|
|
# Command:
|
|
# Sub-Command: puts
|
|
#
|
|
# Invocation: load @M@
|
|
# Result: %R{
|
|
# }R%
|
|
# Comment: %C{
|
|
# Check the 'puts' command
|
|
# }C%
|
|
#
|
|
##############################################################################
|
|
|
|
if {[module-info mode "load"] || [module-info mode "display"]} {
|
|
puts stdout
|
|
puts stderr
|
|
puts -nonewline stdout
|
|
puts -nonewline stderr
|
|
|
|
puts stdout textout1
|
|
puts stderr texterr1
|
|
|
|
puts -nonewline stderr texterr2
|
|
puts stderr texterr3
|
|
|
|
puts -nonewline stdout textout2
|
|
puts -nonewline stdout textout3
|
|
}
|
|
|
|
setenv testsuite ok
|