parent
db2ac559a7
commit
24aeea28c1
|
@ -921,6 +921,20 @@
|
||||||
|
|
||||||
(delete-file path))
|
(delete-file path))
|
||||||
|
|
||||||
|
;; Check `file-position`, OS-level pipes, and peek
|
||||||
|
(when (and (memq (system-type) '(unix macosx))
|
||||||
|
(file-exists? "/bin/cat"))
|
||||||
|
(define-values (sp stdout-in stdin-out no-stderr) (subprocess #f #f (current-error-port) "/bin/cat"))
|
||||||
|
(write-bytes #"abcd\n" stdin-out)
|
||||||
|
(close-output-port stdin-out)
|
||||||
|
(test 0 file-position stdout-in)
|
||||||
|
(test #"abc" peek-bytes 3 0 stdout-in)
|
||||||
|
(test 0 file-position stdout-in)
|
||||||
|
(test #\a read-char stdout-in)
|
||||||
|
(test 1 file-position stdout-in)
|
||||||
|
(close-input-port stdout-in)
|
||||||
|
(subprocess-wait sp))
|
||||||
|
|
||||||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Check reader error-message formatting for a struct port
|
;; Check reader error-message formatting for a struct port
|
||||||
|
|
||||||
|
|
|
@ -4202,6 +4202,7 @@ do_file_position(const char *who, int argc, Scheme_Object *argv[], int can_false
|
||||||
return scheme_void;
|
return scheme_void;
|
||||||
} else {
|
} else {
|
||||||
mzlonglong pll;
|
mzlonglong pll;
|
||||||
|
int already_ungot = 0;
|
||||||
if (f) {
|
if (f) {
|
||||||
pll = BIG_OFF_T_IZE(ftello)(f);
|
pll = BIG_OFF_T_IZE(ftello)(f);
|
||||||
} else if (fd) {
|
} else if (fd) {
|
||||||
|
@ -4210,6 +4211,7 @@ do_file_position(const char *who, int argc, Scheme_Object *argv[], int can_false
|
||||||
sz = rktio_get_file_position(scheme_rktio, fd);
|
sz = rktio_get_file_position(scheme_rktio, fd);
|
||||||
if (!sz) {
|
if (!sz) {
|
||||||
pll = do_tell(argv[0], 0);
|
pll = do_tell(argv[0], 0);
|
||||||
|
already_ungot = 1;
|
||||||
} else {
|
} else {
|
||||||
pll = *sz;
|
pll = *sz;
|
||||||
free(sz);
|
free(sz);
|
||||||
|
@ -4247,7 +4249,7 @@ do_file_position(const char *who, int argc, Scheme_Object *argv[], int can_false
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Back up for un-gotten & peeked chars: */
|
/* Back up for un-gotten & peeked chars: */
|
||||||
if (SCHEME_INPUT_PORTP(argv[0])) {
|
if (!already_ungot && SCHEME_INPUT_PORTP(argv[0])) {
|
||||||
Scheme_Input_Port *ip;
|
Scheme_Input_Port *ip;
|
||||||
ip = scheme_input_port_record(argv[0]);
|
ip = scheme_input_port_record(argv[0]);
|
||||||
pll -= ip->ungotten_count;
|
pll -= ip->ungotten_count;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user