~ chicken-core (chicken-5) 71d2cf87f101bd10411a4bd0dd20eeac5dc484eb
commit 71d2cf87f101bd10411a4bd0dd20eeac5dc484eb Author: Peter Bex <peter@more-magic.net> AuthorDate: Sun Jan 21 14:14:09 2018 +0100 Commit: Evan Hanson <evhan@foldling.org> CommitDate: Mon Jan 22 13:17:54 2018 +1300 Move "system" into chicken.process (posix.scm) We already have system* in there, and it exports both, so it only makes sense to move the definition from library.scm here too. Signed-off-by: Evan Hanson <evhan@foldling.org> diff --git a/chicken-uninstall.scm b/chicken-uninstall.scm index bb4e7852..6141e176 100644 --- a/chicken-uninstall.scm +++ b/chicken-uninstall.scm @@ -35,6 +35,7 @@ (chicken irregex) (chicken port) (chicken pathname) + (chicken process) (chicken process-context) (chicken string)) diff --git a/chicken.import.scm b/chicken.import.scm index 24bc00a8..d0908e29 100644 --- a/chicken.import.scm +++ b/chicken.import.scm @@ -155,7 +155,7 @@ (symbol-append . chicken.base#symbol-append) symbol-escape (syntax-error . chicken.syntax#syntax-error) - system + (system . chicken.process#system) (unregister-feature! . chicken.platform#unregister-feature!) (vector-copy! . chicken.base#vector-copy!) (vector-resize . chicken.base#vector-resize) diff --git a/library.scm b/library.scm index 992fdb9d..a8b2f184 100644 --- a/library.scm +++ b/library.scm @@ -1212,14 +1212,6 @@ EOF (lp val forward))))) obj))) -(define (system cmd) - (##sys#check-string cmd 'system) - (let ((r (##core#inline "C_execute_shell_command" cmd))) - (cond ((fx< r 0) - (##sys#update-errno) - (##sys#signal-hook #:process-error 'system "`system' invocation failed" cmd) ) - (else r) ) ) ) - ;;; Dynamic Load diff --git a/posix.scm b/posix.scm index fdd97dbb..24a96cf8 100644 --- a/posix.scm +++ b/posix.scm @@ -180,6 +180,16 @@ (import chicken scheme chicken.posix chicken.platform) +;;; Execute a shell command: + +(define (system cmd) + (##sys#check-string cmd 'system) + (let ((r (##core#inline "C_execute_shell_command" cmd))) + (cond ((fx< r 0) + (##sys#update-errno) + (##sys#signal-hook #:process-error 'system "`system' invocation failed" cmd)) + (else r)))) + ;;; Like `system', but bombs on nonzero return code: (define (system* str) diff --git a/types.db b/types.db index 298c4e97..b65647e1 100644 --- a/types.db +++ b/types.db @@ -1402,7 +1402,6 @@ (symbol-escape (#(procedure #:clean) symbol-escape (#!optional *) *)) -(system (#(procedure #:clean #:enforce) system (string) fixnum)) (##sys#void (#(procedure #:pure) void (#!rest) undefined)) ;; chicken (internal) @@ -2099,6 +2098,7 @@ ;; process +(chicken.process#system (#(procedure #:clean #:enforce) chicken.process#system (string) fixnum)) (chicken.process#system* (#(procedure #:clean #:enforce) chicken.process#system* (string #!rest) undefined)) (chicken.process#qs (#(procedure #:clean #:enforce) chicken.process#qs (string) string))Trap