Skip to content

Commit 013a8cc

Browse files
committed
builtin/meta_oils.py: Mark internal files as persistent
This fixes the following issue: $ cat source.osh exec 25>out echo hello>&25 cat out $ bin/osh -c '. ./source.osh' hello [ -c flag ]:1: . builtin I/O error: Bad file descriptor Signed-off-by: Andrii Sultanov <[email protected]>
1 parent b60abc2 commit 013a8cc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

builtin/meta_oils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def _LoadDiskFile(self, fs_path, blame_loc):
198198
# type: (str, loc_t) -> Tuple[mylib.LineReader, cmd_parse.CommandParser]
199199
try:
200200
# Shell can't use descriptors 3-9
201-
f = self.fd_state.Open(fs_path)
201+
f = self.fd_state.Open(fs_path, persistent=True)
202202
except (IOError, OSError) as e:
203203
self.errfmt.Print_(
204204
'%s %r failed: %s' %
@@ -207,6 +207,7 @@ def _LoadDiskFile(self, fs_path, blame_loc):
207207
return None, None
208208

209209
line_reader = reader.FileLineReader(f, self.arena)
210+
self.fd_state.SetCallback(f, line_reader.ReplaceFd)
210211
c_parser = self.parse_ctx.MakeOshParser(line_reader)
211212
return f, c_parser
212213

0 commit comments

Comments
 (0)