diff options
Diffstat (limited to 'scsh-process.scm')
-rw-r--r-- | scsh-process.scm | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/scsh-process.scm b/scsh-process.scm index a6d4bdf..b106bbf 100644 --- a/scsh-process.scm +++ b/scsh-process.scm @@ -11,7 +11,7 @@ ;; WARNING: Don't mix with threading unless you're using ;; Chicken 4.8.1 rev 47b5be71 or later. ;; -;;; Copyright (c) 2012-2018, Peter Bex +;;; Copyright (c) 2012-2020, Peter Bex ;; All rights reserved. ; ; Redistribution and use in source and binary forms, with or without @@ -58,7 +58,8 @@ (chicken-5 (import (chicken base) (chicken condition) (chicken io) (chicken port) (chicken file) (chicken file posix) (chicken fixnum) (chicken string) (chicken process) - (chicken process signal) srfi-18 llrb-fixnum-table)) + (chicken bitwise) (chicken process signal) + srfi-18 llrb-fixnum-table)) (else (import chicken) (use data-structures (rename extras (read-file read-list)) utils files ports posix srfi-1 srfi-18) @@ -370,7 +371,11 @@ (define (run/file* thunk) (let ((temp-file (create-temporary-file))) (wait (fork (lambda () - (let ((fd (file-open temp-file open/wronly))) + (let ((fd (file-open temp-file + open/wronly + (bitwise-ior perm/irusr perm/iwusr + perm/irgrp perm/iwgrp + perm/iroth perm/iwoth)))) (duplicate-fileno fd 1) (with-output-to-port (open-output-file* 1) thunk))))) temp-file)) @@ -449,14 +454,24 @@ ((_ (> ?fd ?file-name)) (duplicate-fileno (file-open (maybe->string `?file-name) - (fx+ (fx+ open/wronly open/creat) open/trunc)) + (fx+ (fx+ open/wronly open/creat) open/trunc) + (bitwise-ior perm/irusr perm/iwusr + perm/irgrp perm/iwgrp + perm/iroth perm/iwoth)) `?fd)) ((_ (>> ?fd ?file-name)) (duplicate-fileno (file-open (maybe->string `?file-name) - (fx+ open/wronly (fx+ open/append open/creat))) + (fx+ open/wronly (fx+ open/append open/creat)) + (bitwise-ior perm/irusr perm/iwusr + perm/irgrp perm/iwgrp + perm/iroth perm/iwoth)) `?fd)) ((_ (< ?fd ?file-name)) - (duplicate-fileno (file-open (maybe->string `?file-name) open/rdonly) + (duplicate-fileno (file-open (maybe->string `?file-name) + open/rdonly + (bitwise-ior perm/irusr perm/iwusr + perm/irgrp perm/iwgrp + perm/iroth perm/iwoth)) `?fd)) ((_ (<< ?fd ?object)) (fork/pipe+ `((1 ?fd)) (lambda () (display `?object (open-output-file* 1))))) |