When writing a file using editors, most of them (fancy IDEs like JetBrains to text editors like VS Code to even minimal TUI apps like nvim) automatically add a newline to the end of the file, signifying that the file is finished.
This doesn't exist on every file, and for files which don't have this, the terminal emulator adds a % at the end to let the user know that the file wasn't closed correctly. *
This behaviour is missing from secrets cat, and if a file does not have a proper ending, then the last line doesn't display properly. Well, the last line does get printed out for a split second, but the terminal emulator overwrites it. This behaviour also exists when using bash in a TTY, so it is not a terminal emulator issue.
To Reproduce
Write a file using secrets write without a newline
Read the file using secrets cat
See last line get erased
Pipe the output to a file
Run cat on the file
See the correct output (with a % at the end if on terminal emulators, or nothing if on TTY)
Expected behavior
All the lines from the output should be printed irrelevant of the ending of the file (or lack thereof)
Screenshots
Platform (please complete the following information)
Device: Dell Precision 3480
OS: NixOS 24.05
Version ["0.12.0","1.15.1","1","1"]
Additional context
This has been tested on multiple terminal emulators, but the behaviour is unchanging. I have also tried adding process.stdout.end() to manually flush the stream, but that didn't work either. The only way I got it partially working was to output a \n to stderr.
Describe the bug
When writing a file using editors, most of them (fancy IDEs like JetBrains to text editors like VS Code to even minimal TUI apps like nvim) automatically add a newline to the end of the file, signifying that the file is finished.
This doesn't exist on every file, and for files which don't have this, the terminal emulator adds a
%
at the end to let the user know that the file wasn't closed correctly. *This behaviour is missing from
secrets cat
, and if a file does not have a proper ending, then the last line doesn't display properly. Well, the last line does get printed out for a split second, but the terminal emulator overwrites it. This behaviour also exists when usingbash
in a TTY, so it is not a terminal emulator issue.To Reproduce
secrets write
without a newlinesecrets cat
cat
on the file%
at the end if on terminal emulators, or nothing if on TTY)Expected behavior
All the lines from the output should be printed irrelevant of the ending of the file (or lack thereof)
Screenshots
Platform (please complete the following information)
["0.12.0","1.15.1","1","1"]
Additional context
This has been tested on multiple terminal emulators, but the behaviour is unchanging. I have also tried adding
process.stdout.end()
to manually flush the stream, but that didn't work either. The only way I got it partially working was to output a\n
tostderr
.More discussion has been done on Polykey-CLI#305 (comment)
Notify maintainers
@aryanjassal