mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-08 13:37:35 +02:00
Open both input and output ports to the same fd before using either,
to prevent one closing the fd.
This commit is contained in:
parent
3cd5375c28
commit
7cea27ec20
1 changed files with 4 additions and 3 deletions
|
@ -144,9 +144,10 @@
|
||||||
(call-with-locked-file
|
(call-with-locked-file
|
||||||
path
|
path
|
||||||
(lambda (fd)
|
(lambda (fd)
|
||||||
(let* ((str (port->string (open-input-file-descriptor fd)))
|
(let* ((in (open-input-file-descriptor fd))
|
||||||
(res (proc str))
|
(out (open-output-file-descriptor fd))
|
||||||
(out (open-output-file-descriptor fd)))
|
(str (port->string in))
|
||||||
|
(res (proc str)))
|
||||||
(set-file-position! out seek/set 0)
|
(set-file-position! out seek/set 0)
|
||||||
(display res out)
|
(display res out)
|
||||||
(file-truncate out (string-size res))
|
(file-truncate out (string-size res))
|
||||||
|
|
Loading…
Add table
Reference in a new issue