Skip to content

Commit

Permalink
Fix warning on GLib >=2.79.2
Browse files Browse the repository at this point in the history
  • Loading branch information
C-512L committed Jul 11, 2024
1 parent 94f3a6f commit d7c4343
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ddterm/shell/sd_journal.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@

import GLib from 'gi://GLib';
import Gio from 'gi://Gio';
// BEGIN ESM

import Gi from 'gi';
// END ESM

/* We only care about Linux here, because otherwise it won't be systemd */
const SOL_SOCKET = 1;
Expand Down Expand Up @@ -75,6 +79,14 @@ export function sd_journal_stream_fd(identifier, priority = LOG_INFO, level_pref
}

try {
// BEGIN ESM
if (GLib.check_version(2, 79, 2) === null) {
const GLibUnix = Gi.require('GLibUnix', '2.0');
GLibUnix.set_fd_nonblocking(fd, false);
return fd;
}

// END ESM
GLib.unix_set_fd_nonblocking(fd, false);
return fd;
} catch (ex) {
Expand Down

0 comments on commit d7c4343

Please sign in to comment.