Handle process and terminal correctly.

This commit is contained in:
Dominik Pantůček 2023-04-04 14:41:13 +02:00
parent 74afca1354
commit 2232786316
3 changed files with 14 additions and 5 deletions

View file

@ -34,14 +34,17 @@
(import scheme
(chicken base)
(chicken process-context)
(chicken process))
(chicken process)
ansi)
;; Starts an editor on given file
(define (edit-file file-path)
(print "Editing...")
(let* ((edvar (get-environment-variable "EDITOR"))
(editor (or edvar "editor")))
(process-run editor (list file-path))
))
(editor (or edvar "editor"))
(pid (process-run editor (list file-path))))
(process-wait pid)
(clrscr)
(flush-output)))
)