]> gitweb.factorcode.org Git - factor.git/commitdiff
editors: Launch editors as child processes. Hopefully this is ok on
authorDoug Coleman <doug.coleman@gmail.com>
Fri, 16 Mar 2018 23:13:17 +0000 (18:13 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Fri, 16 Mar 2018 23:13:17 +0000 (18:13 -0500)
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).

basis/editors/editors.factor

index fe21dfe4df8eeb8441b32ef01fd042982f8dbbba..5efafdbb7e4d3e17126ff10b143cd70fca0ebb0a 100644 (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?