I mean, it would be pretty trivial to provide this through ccall right? I imagine I could do it this afternoon if I took the time to read up on ccall. But it would be better to be a package kind of maintained by some github organization, like JuliaStrings etc except with a “OS interaction” theme or something.
I just tested this on my computer, and it worked:
julia> ccall(:execvp,Int32,(Cstring,Array{Cstring}),"/home/dlakelan/julia-latest/bin/julia",Cstring[])
Also this:
julia> ccall(:execvp,Int32,(Cstring,Array{Cstring}),"julia",Cstring[])
since execvp
searches the path in the same way the shell does and my personal julia install is in my path
it should also be possible to create a function like this which just re-execs julia with the same arguments (figured out the specific sauce required).
julia> function reexec()
cmd = Base.julia_cmd()
@ccall execvp(cmd.exec[1]::Cstring,cmd.exec[2:end]::Ptr{Cstring})::Int32
end
reexec (generic function with 1 method)
julia> reexec()
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.7.0-beta3.0 (2021-07-07)
_/ |\__'_|_|_|\__'_| | release-1.7/e76c9dad42 (fork: 68 commits, 71 days)
|__/ |