Skip to content

Commit b398119

Browse files
committed
Report known error when cwd cannot be retrieved
Closes #457.
1 parent 7295363 commit b398119

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

NEWS.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Modules 5.1.1 (not yet released)
2222
* Remove the *already loaded* message displayed when verbosity level is higher
2323
or equal to ``verbose2`` if new tags are applied to the loaded module. (fix
2424
issue #456)
25+
* Report a global known error when current working directory cannot be
26+
retrieved due to the removal of this directory. (fix issue #457)
2527

2628

2729
Modules 5.1.0 (2022-04-30)

tcl/util.tcl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ proc getAbsolutePath {path} {
7676
} else {
7777
# register pwd at first call
7878
if {![isStateDefined cwd]} {
79-
setState cwd [pwd]
79+
# raise a global known error if cwd cannot be retrieved (especially
80+
# when this directory has been removed)
81+
if {[catch {setState cwd [pwd]} errorMsg]} {
82+
knerror $errorMsg
83+
}
8084
}
8185
set curdir [getState cwd]
8286
}

0 commit comments

Comments
 (0)