Skip to content

Commit

Permalink
file parsing: check for PWD existence
Browse files Browse the repository at this point in the history
  • Loading branch information
hjoliver committed Aug 16, 2023
1 parent 52aae8b commit e71e428
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cylc/flow/parsec/fileparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,11 @@ def read_and_proc(
fpath = _get_fpath_for_source(fpath, opts)
fdir = os.path.dirname(fpath)

odir = os.getcwd()
try:
odir = os.getcwd()
except FileNotFoundError:

Check warning on line 406 in cylc/flow/parsec/fileparse.py

View check run for this annotation

Codecov / codecov/patch

cylc/flow/parsec/fileparse.py#L406

Added line #L406 was not covered by tests
# user's current working directory does not exist!
odir = None

Check warning on line 408 in cylc/flow/parsec/fileparse.py

View check run for this annotation

Codecov / codecov/patch

cylc/flow/parsec/fileparse.py#L408

Added line #L408 was not covered by tests

# Move to the file location to give the template processor easy access to
# other files in the workflow directory (whether source or installed).
Expand Down Expand Up @@ -500,7 +504,8 @@ def read_and_proc(
if do_contin:
flines = _concatenate(flines)

os.chdir(odir)
if odir is not None:
os.chdir(odir)

# return rstripped lines
return [fl.rstrip() for fl in flines]
Expand Down

0 comments on commit e71e428

Please sign in to comment.