Skip to content

Commit f47b1ec

Browse files
committed
Fix basic builder aborting
If aux directory is specified, documents from sub directories are involved, initial call of pdflatex may return non-zero exit status, as required directories don't yet exist. Hence suppress aborting build process and create them, manually, before continuing normally.
1 parent 21a4d68 commit f47b1ec

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

docs/buildsystem.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ The `basic` builder is a simple, straight-forward build system, which simply run
144144

145145
**Note:** To use `basic` builder set `"builder": "basic"` in sublime-build file or any of the supported settings.
146146

147+
**Note:** Initial pdflatex call(s) may return with `error`, if required directories are to be created. Don't worry about it, that's normal behavior.
148+
147149
Supported settings:
148150

149151
- `bibtex` - the bibliography engine to use, if not explicitly requested by build process. Valid values are `biber`, `bibtex` or `bibtex8`.

plugins/builder/basic_builder.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,11 @@ def commands(self) -> CommandGenerator:
7171

7272
latex.append(self.tex_name)
7373

74+
# Initial pdflatex run may fail, if required diretories are not yet present
75+
self.abort_on_error = False
7476
yield (latex, f"running {engine}...")
7577

76-
# Create required directories
78+
# Create required directories and retry
7779
while matches := FILE_WRITE_ERROR_REGEX.findall(self.out):
7880
for path, _ in matches:
7981
abspath = os.path.join(self.aux_directory_full or self.tex_dir, path)
@@ -82,6 +84,8 @@ def commands(self) -> CommandGenerator:
8284

8385
yield (latex, f"running {engine}...")
8486

87+
self.abort_on_error = True
88+
8589
# Check for citations
8690
# We need to run pdflatex twice after bibtex
8791
run_bibtex = False

0 commit comments

Comments
 (0)