JuliaParallel / MPI.jl

MPI wrappers for Julia
https://juliaparallel.org/MPI.jl/
The Unlicense
376 stars 122 forks source link

Cannot return user specified exit status with `exit()` when using `mpiexecjl` #833

Closed cohensbw closed 3 months ago

cohensbw commented 3 months ago

If the command

mpiexecjl -n 2 julia -e "using MPI; MPI.Init(); exit(100)"

is run, the reported exit status returned by

echo $?

will always return 1 regardless of the argument of exit().

giordano commented 3 months ago

Uhm, the problem is that we're returning the exit status from the failing run at https://github.com/JuliaParallel/MPI.jl/blob/7b97da711b90f2c0769ffe513a946958b4ec8ae1/bin/mpiexecjl#L64 which is always 1, whatever is the exit status of the subprocess:

% julia -e 'run(`bash -c "exit 2"`)' 2> /dev/null; echo $? 
1
vchuravy commented 3 months ago

run doesn't propagate the exit code. You need success or manually capture and propagate it