saturn: change spawn behaviour
use fork() and exec() and close filehandles in child
This commit is contained in:
parent
11f4b123bf
commit
5e423fb8fd
@ -49,19 +49,20 @@
|
|||||||
|
|
||||||
(fn spawn-async [vec]
|
(fn spawn-async [vec]
|
||||||
(let [pid (posix.unistd.fork)]
|
(let [pid (posix.unistd.fork)]
|
||||||
(if (> pid 0)
|
(if (> pid 0) true
|
||||||
true
|
(< pid 0) (assert (= "can't fork" nil))
|
||||||
(< pid 0)
|
(do
|
||||||
(assert (= "can't spawn" nil))
|
(for [f 3 255] (posix.unistd.close f))
|
||||||
(posix.spawn vec))))
|
(posix.execp "/usr/bin/env" vec)))))
|
||||||
|
|
||||||
(fn launch [app]
|
(fn launch [app]
|
||||||
; (print (if app.DBusActivatable "dbus" "not dbus"))
|
; (print (if app.DBusActivatable "dbus" "not dbus"))
|
||||||
(let [cmd (parse-percents app.Exec)]
|
(let [cmd (parse-percents app.Exec)]
|
||||||
(if app.Terminal
|
(if app.Terminal
|
||||||
(spawn-async ["/usr/bin/env" "kitty" cmd])
|
(spawn-async ["kitty" cmd])
|
||||||
(spawn-async ["/usr/bin/env" "sh" "-c" cmd]))
|
(spawn-async ["sh" "-c" cmd]))
|
||||||
(os.exit)))
|
(Gtk.main_quit)
|
||||||
|
(os.exit 0)))
|
||||||
|
|
||||||
(fn button-for [app]
|
(fn button-for [app]
|
||||||
(doto (Gtk.Button
|
(doto (Gtk.Button
|
||||||
|
Loading…
Reference in New Issue
Block a user