editors: Launch editors as child processes. Hopefully this is ok on

other platforms.

On Windows, VSCode gets launched as a child process, which kills the
editor when Factor exits. This is not what we want. Add an overridable
option to launch editors as child processes, which should get repated
when Factor quits.

The confusion comes from ``run-detached`` which itself just
waits until the child process returns (as opposed to "detaching" a child
process from the parent process, which is called +new-group+ or
+new-session+ instead).
paths
Doug Coleman 2018-03-16 18:13:17 -05:00
parent e50be2a1ca
commit f164f47e41
1 changed files with 4 additions and 0 deletions

View File

@ -25,10 +25,14 @@ M: f editor-command
HOOK: editor-detached? editor-class ( -- ? )
M: object editor-detached? t ;
HOOK: editor-is-child? editor-class ( -- ? )
M: object editor-is-child? f ;
: run-and-wait-for-editor ( command -- )
<process>
swap >>command
editor-detached? >>detached
editor-is-child? [ +new-group+ >>group ] unless
run-process
300 milliseconds sleep
dup status>> { 0 f } member?