Skip to content

Commit

Permalink
[core] Flush after writeln() to --debug-file
Browse files Browse the repository at this point in the history
And OILS_DEBUG_DIR

Tweak log strings
  • Loading branch information
Andy C committed Sep 5, 2023
1 parent 6334e6e commit 9915015
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
12 changes: 7 additions & 5 deletions core/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,8 @@ def Matches(self, comp):
status = self.cmd_ev.RunFuncForCompletion(self.func, argv)
commands_changed = self.comp_lookup.GetCommandsChanged()

#self.debug('comp.first %s, commands_changed: %s' % (comp.first, commands_changed))
self.debug('comp.first %r, commands_changed: %s' %
(comp.first, ', '.join(commands_changed)))

if status == 124:
cmd = os_path.basename(comp.first)
Expand All @@ -614,20 +615,21 @@ def Matches(self, comp):
# Not changing it means there were no completions.
# TODO: This writes over the command line; it would be better to use an
# error object.
print_stderr('osh: Ran function %r but COMPREPLY was unset' %
print_stderr('osh error: Ran function %r but COMPREPLY was unset' %
self.func.name)
return

if val.tag() != value_e.BashArray:
print_stderr('ERROR: COMPREPLY should be an array, got %s' %
print_stderr('osh error: COMPREPLY should be an array, got %s' %
ui.ValType(val))
return

# TODO: Print structured value_t in C++. This line is wrong:
# self.debug('COMPREPLY %s' % val)
if 0:
self.debug('> %r' % val) # CRASHES in C++

array_val = cast(value.BashArray, val)
for s in array_val.strs:
#self.debug('> %r' % s)
yield s


Expand Down
1 change: 1 addition & 0 deletions core/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def write(self, s):
def writeln(self, s):
# type: (str) -> None
self.write(s + '\n')
self.f.flush()

def isatty(self):
# type: () -> bool
Expand Down

0 comments on commit 9915015

Please sign in to comment.