Skip to content

Commit

Permalink
Return dummy true on compat module function
Browse files Browse the repository at this point in the history
Make compatibility module function to always return a value to be able
to check function result either new main version or compat version is
called.

Adapt cmake, perl, python and ruby compat module function to return a
true value. Always true is returned as compat version does not handle
returning error exit code.
  • Loading branch information
xdelaruelle committed Nov 21, 2017
1 parent 040e726 commit dfbdb9f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions init/cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,7 @@ endif()
@compatversion@ include(${tempfile_name})
@compatversion@ file(REMOVE ${tempfile_name})
@compatversion@ endif()
@compatversion@ # return value as done on new main version
@compatversion@ set(module_result TRUE PARENT_SCOPE)
@compatversion@ endfunction(module)
@compatversion@endif()
5 changes: 1 addition & 4 deletions init/perl.pm.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ undef $_mlre;
@compatversion@ { no warnings 'redefine';
@compatversion@ *module = sub {
@compatversion@ eval `@libexecdir@/modulecmd-compat perl @_`;
@compatversion@ if ($@) {
@compatversion@ use Carp;
@compatversion@ confess "module-error: $@\n";
@compatversion@ }
@compatversion@ # return value as done on new main version
@compatversion@ return 1;
@compatversion@ };
@compatversion@ }
Expand Down
2 changes: 2 additions & 0 deletions init/python.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ del _mlre
@compatversion@ # set module command in accordance with active version
@compatversion@ def module(command, *arguments):
@compatversion@ exec(subprocess.Popen(['@libexecdir@/modulecmd-compat', 'python', command] + list(arguments), stdout=subprocess.PIPE).communicate()[0])
@compatversion@ # return value as done on new main version
@compatversion@ return True
2 changes: 2 additions & 0 deletions init/ruby.rb.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ eval `#{_mlre}@TCLSH@ @libexecdir@/modulecmd.tcl ruby autoinit`
@compatversion@ args = args.join(' ')
@compatversion@ end
@compatversion@ eval `@libexecdir@/modulecmd-compat ruby #{args}`
@compatversion@ # return value as done on new main version
@compatversion@ return true
@compatversion@ end
@compatversion@ end
@compatversion@end

0 comments on commit dfbdb9f

Please sign in to comment.