Julia shell and Windows shell (cmd) giving different result

I am attempting to call xelatex from Julia’s run() function. For some reason I am getting a missing fonts error when running this from Julia. When running the same command (from the same location) in Windows cmd, the document builds fine.

What could possibly be the difference between Julia’s shell and cmd???

Here’s some details…

julia> pwd()
"c:\\Work\\IST\\Projects\\JuliaPackages\\BuildAndBenchmark.jl\\tex\\CatapultModel\\systemerror"

shell> systemerror.bat

c:\Work\IST\Projects\JuliaPackages\BuildAndBenchmark.jl\tex\CatapultModel\systemerror>xelatex -shell-escape systemerror.tex 
This is XeTeX, Version 3.141592653-2.6-0.999993 (TeX Live 2021/W32TeX) (preloaded format=xelatex)
 \write18 enabled.
entering extended mode
.
.
.
kpathsea: Running mktexmf FreeSerif.mf

The command name is C:\Programs\texlive\2021\bin\win32\mktexmf
name = FreeSerif, rootname = FreeSerif, pointsize =
mktexmf: empty or non-existent rootfile!
Cannot find FreeSerif.mf.

Now running in cmd:

C:\Work\IST\Projects\JuliaPackages\BuildAndBenchmark.jl\tex\CatapultModel\systemerror>systemerror.bat

C:\Work\IST\Projects\JuliaPackages\BuildAndBenchmark.jl\tex\CatapultModel\systemerror>xelatex -shell-escape systemerror.tex 
This is XeTeX, Version 3.141592653-2.6-0.999993 (TeX Live 2021/W32TeX) (preloaded format=xelatex)
 \write18 enabled.
entering extended mode
.
.
.
Output written on systemerror.pdf (23 pages).
Transcript written on systemerror.log.

The shell mode in the REPL isn’t really a shell.

If you NEED to run a Windows CMD process in Julia, using shell> cmd /c <cmd> instead of shell> <cmd> (for example) seems to solve a lot of problems. If you were to prefix each line of your .bat file with that, I wonder if you would have better luck?

1 Like

Run Julia from a git bash. The environment settings should be sane(r).

2 Likes

OK, that did the trick! Actually it seems to work in other instances of Julia started from git bash or from cmd or from VS Code terminal. So just my current running session fails for some reason. Wish I could understand why, but I guess maybe some environment variable that is needed is set different in my current running instance.