Skip to content

Commit

Permalink
Replaced fdatasync with fsync (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitamikhaylov committed Aug 23, 2024
1 parent 2a70695 commit 711c18e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/replxx_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -643,12 +643,12 @@ char const* Replxx::ReplxxImpl::input( std::string const& prompt ) {
}
if ( ! _errorMessage.empty() ) {
dprintf( _out_fd, "%s", _errorMessage.c_str() );
fdatasync( _out_fd );
fsync( _out_fd );
_errorMessage.clear();
}
if ( isUnsupportedTerm() ) {
dprintf( _out_fd, "%s", prompt.c_str() );
fdatasync( _out_fd );
fsync( _out_fd );
return ( read_from_stdin() );
}
std::unique_lock<std::mutex> l( _mutex );
Expand Down Expand Up @@ -1236,7 +1236,7 @@ char32_t Replxx::ReplxxImpl::do_complete_line( bool showCompletions_ ) {
refresh_line();
_pos = savePos;
dprintf(_out_fd, "\nDisplay all %u possibilities? (y or n)", static_cast<unsigned int>( _completions.size() ) );
fdatasync(_out_fd);
fsync(_out_fd);
onNewLine = true;
while (c != 'y' && c != 'Y' && c != 'n' && c != 'N' && c != Replxx::KEY::control('C')) {
do {
Expand Down Expand Up @@ -1285,7 +1285,7 @@ char32_t Replxx::ReplxxImpl::do_complete_line( bool showCompletions_ ) {
for (size_t row = 0; row < rowCount; ++row) {
if (row == pauseRow) {
dprintf(_out_fd, "\n--More--");
fdatasync(_out_fd);
fsync(_out_fd);
c = 0;
bool doBeep = false;
while (c != ' ' && c != Replxx::KEY::ENTER && c != 'y' && c != 'Y' &&
Expand Down Expand Up @@ -1335,7 +1335,7 @@ char32_t Replxx::ReplxxImpl::do_complete_line( bool showCompletions_ ) {
if ( index < _completions.size() ) {
Completion const& c( _completions[index] );
int itemLength = static_cast<int>(c.text().length());
fdatasync(_out_fd);
fsync(_out_fd);

if ( longestCommonPrefix > 0 ) {
static UnicodeString const col( ansi_color( Replxx::Color::BRIGHTMAGENTA ) );
Expand Down Expand Up @@ -1365,7 +1365,7 @@ char32_t Replxx::ReplxxImpl::do_complete_line( bool showCompletions_ ) {
}
}
}
fdatasync(_out_fd);
fsync(_out_fd);
}

// display the prompt on a new line, then redisplay the input buffer
Expand Down
2 changes: 1 addition & 1 deletion src/terminal.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ char32_t read_unicode_character(int in_fd_) {

void beep(int fd_) {
dprintf(fd_, "\x7"); // ctrl-G == bell/beep
fdatasync(fd_);
fsync(fd_);
}

// replxx_read_char -- read a keystroke or keychord from the keyboard, and translate it
Expand Down

0 comments on commit 711c18e

Please sign in to comment.