@@ -8,6 +8,7 @@ module Malt
88import .. QuartoNotebookRunner: UserError
99
1010import BSON
11+ import IOCapture
1112import Pkg
1213import TOML
1314using Sockets: Sockets
@@ -129,6 +130,17 @@ mutable struct Worker <: AbstractWorker
129130
130131 err_output = read (errors_log_file, String)
131132 if isnothing (manifest_error)
133+ empty_result = IOCapture. capture (; rethrow = InterruptException) do
134+ run (_get_worker_cmd (; exe, env, exeflags, file = String (empty_file)))
135+ end
136+ if empty_result. error
137+ message = """
138+ Failed to start worker process.
139+
140+ $(empty_result. output)
141+ """
142+ error (message)
143+ end
132144 # Generic error reporting when we've not received a port
133145 # number from the worker. This just prints out the error
134146 # message and stacktrace that have come from the worker
@@ -367,15 +379,16 @@ end
367379
368380# The entire `src` dir should be relocatable, so that worker.jl can include("MsgType.jl").
369381const startup_file = RelocatableFolders. @path joinpath (@__DIR__ , " startup.jl" )
382+ const empty_file = RelocatableFolders. @path joinpath (@__DIR__ , " empty.jl" )
370383const worker_package = RelocatableFolders. @path joinpath (@__DIR__ , " QuartoNotebookWorker" )
371384
372- function _get_worker_cmd (; exe, env, exeflags)
385+ function _get_worker_cmd (; exe, env, exeflags, file = String (startup_file) )
373386 defaults = Dict (
374387 " OPENBLAS_NUM_THREADS" => " 1" ,
375388 " QUARTONOTEBOOKWORKER_PACKAGE" => String (worker_package),
376389 )
377390 env = vcat (Base. byteenv (defaults), Base. byteenv (env))
378- return addenv (` $exe --startup-file=no $exeflags $( String (startup_file)) ` , env)
391+ return addenv (` $exe --startup-file=no $exeflags $file ` , env)
379392end
380393
381394# Checks whether a `julia` command (including it's program flags and juliaup
0 commit comments