Handle process and terminal correctly.
This commit is contained in:
parent
74afca1354
commit
2232786316
3 changed files with 14 additions and 5 deletions
|
@ -225,7 +225,7 @@ WEB-STATIC-SOURCES=web-static.scm member-record.import.scm \
|
|||
web-static.o: web-static.import.scm
|
||||
web-static.import.scm: $(WEB-STATIC-SOURCES)
|
||||
|
||||
ENVIRONMENT-SOURCES=environment.scm
|
||||
ENVIRONMENT-SOURCES=environment.scm ansi.import.scm
|
||||
|
||||
environment.o: environment.import.scm
|
||||
environment.import.scm: $(ENVIRONMENT-SOURCES)
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
ansi-string-length
|
||||
ansi-paragraph-format
|
||||
ansi-string
|
||||
clrscr
|
||||
ansi-tests!
|
||||
)
|
||||
|
||||
|
@ -211,6 +212,11 @@
|
|||
(cons arg res)
|
||||
(cons arg (cons (apply ansi (reverse kws)) res))))))))))
|
||||
|
||||
;; Clears the entire screen and positions cursor in the upper-left
|
||||
;; corner.
|
||||
(define (clrscr)
|
||||
(display "\x1b[0m\x1b[2J\x1b[0;0H"))
|
||||
|
||||
;; Performs ANSI module self-tests.
|
||||
(define (ansi-tests!)
|
||||
(run-tests
|
||||
|
|
|
@ -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)))
|
||||
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue