Spawn process in new window

question

#1

I’m trying to launch a new process and have it run in a new window. The process I’m trying to spawn is a console application, and I want a new console window to open, in which that process runs. Ideally the new process would also be detached from the current process, i.e. should not be killed when I kill the main julia process.

I’m trying
spawn(Cmd(`$(joinpath(JULIA_HOME,Base.julia_exename())) -i`, windows_hide=false, detach=true))
But that doesn’t open a new window… I’m on Windows for this.

Thanks,
David


#2

libuv doesn’t appear to have any way to enable the necessary CreateProcess flag for this (CREATE_NEW_CONSOLE), and even if it did, that flag is mutually-exclusive [1] with the DETACH_PROCESS flag implied by detach=true. Calling AllocConsole [2] from your code after spawning should give a new cmd window.

[1] https://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
[2] https://msdn.microsoft.com/en-us/library/windows/desktop/ms681944(v=vs.85).aspx