cortav  Diff

Differences From Artifact [0dc68c1657]:

To Artifact [047ac156ff]:


   222    222   		input.stream = file
   223    223   		input.src.file = args[1]
   224    224   	end
   225    225   
   226    226   	return main(input, outp, log, mode, suggestions, vars, extrule)
   227    227   end
   228    228   
   229         --- local ok, e = pcall(entry_cli)
   230         -local ok, e = true, entry_cli()
          229  +local ok, e = xpcall(entry_cli, function(e)
          230  +	if not ss.exn.is(e) then
          231  +		e = ss.bug('lua vm error: %s', e)
          232  +	end
          233  +	e.trace = debug.traceback(nil, nil, 1)
          234  +	log:write(e.trace .. '\n')
          235  +	return e
          236  +end)
          237  +-- local ok, e = true, entry_cli()
   231    238   if not ok then
   232    239   	local str = 'translation failure'
   233    240   	if ss.exn.is(e) then
   234    241   		str = e.kind.desc
   235    242   	end
   236    243   	local color = false
   237    244   	if native then
................................................................................
   250    257   			end
   251    258   		end
   252    259   	end
   253    260   	if color then
   254    261   		str = string.format('\27[1;31m%s\27[m', str)
   255    262   	end
   256    263   	log:write(string.format('%s: %s\n', str, e))
          264  +	if ss._debug and ss.exn.is(e) and e.trace then
          265  +		log:write(e.trace)
          266  +	end
   257    267   	os.exit(1)
   258    268   end
   259    269   os.exit(e)