Skip to content

Commit

Permalink
Remove redirection in restricted mode
Browse files Browse the repository at this point in the history
Since the redirection doesn't work in restricted mode, we only add it when `--shell-escape` has been given.  Further, rather than reusing the glog file, we create a special file for capturing the redirection error.  This addresses gregorio-project#1628.
  • Loading branch information
rpspringuel committed Feb 17, 2025
1 parent 136a63c commit bee7b92
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tex/gregoriotex.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1150,8 +1150,14 @@ local function compile_gabc(gabc_file, gtex_file, glog_file, allow_deprecated)
extra_args = extra_args..' -D'
end

local cmd = string.format('%s %s -W -o %s -l %s "%s" 2> %s', gregorio_exe(),
extra_args, gtex_file, glog_file, gabc_file, glog_file)
local cmd = string.format('%s %s -W -o %s -l %s "%s"', gregorio_exe(),
extra_args, gtex_file, glog_file, gabc_file)
if status.shell_escape then
cmd = string.format('%s 2> %s.err', cmd, glog_file)
else
info('Running in restricted mode.\n Some file related errors may not be caputered.\n'
..'Try running with --shell-escape active for more complete error loging.')
end
res = os.execute(cmd)
if res == nil then
err("\nSomething went wrong when executing\n '%s'.\n"
Expand Down

0 comments on commit bee7b92

Please sign in to comment.