`cd` into doc's working directory

pull/364/head
Shuhei Kadowaki 2020-06-13 20:42:57 +09:00
parent e52c30f72e
commit ec986b387b
2 changed files with 10 additions and 2 deletions

View File

@ -25,7 +25,7 @@ function run_doc(
if isnothing(fig_path)
fig_path = if (endswith(doctype, "2pdf") && cache === :off) || endswith(doctype, "2html")
basename(mktempdir(abspath(doc.cwd)))
basename(mktempdir(abspath(cwd)))
else
DEFAULT_FIG_PATH
end
@ -43,7 +43,9 @@ function run_doc(
mimetypes = doc.format.mimetypes
report = Report(doc.cwd, doc.basename, doc.format, mimetypes, throw_errors)
report = Report(cwd, doc.basename, doc.format, mimetypes, throw_errors)
cd_back = let d = pwd(); () -> cd(d); end
cd(cwd)
pushdisplay(report)
try
if cache !== :off && cache !== :refresh
@ -86,6 +88,7 @@ function run_doc(
rethrow(err)
finally
@info "Weaved all chunks" progress=1 _id=PROGRESS_ID
cd_back()
popdisplay(report) # ensure display pops out even if internal error occurs
end

View File

@ -18,6 +18,10 @@ include("test_include.jl")
```julia
@__LINE__ # broken
```
```julia
read("./test_include.jl", String)
```
"""
doc_dir = joinpath(@__DIR__, "mocks")
doc_path = joinpath(doc_dir, "test_meta.jmd")
@ -38,3 +42,4 @@ check_output(i, s) = occursin(s, mock.chunks[i].output)
@test check_output(3, doc_dir)
@test check_output(4, doc_path)
@test_broken check_output(5, 18)
@test check_output(6, string('"', script_line, '"')) # current working directory