Skip to content

Commit

Permalink
Fix Glib warning
Browse files Browse the repository at this point in the history
  • Loading branch information
C-512L committed Jul 3, 2024
1 parent bfcdf69 commit 7a4606e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions ddterm/shell/sd_journal.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@

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

// BEGIN ESM
import * as Config from 'resource:///org/gnome/shell/misc/config.js';
import Gi from 'gi';
const [major, _] = Config.PACKAGE_VERSION.split('.').map(s => Number(s));
// END ESM
/* We only care about Linux here, because otherwise it won't be systemd */
const SOL_SOCKET = 1;
const SO_SNDBUF = 7;
Expand Down Expand Up @@ -75,7 +79,17 @@ export function sd_journal_stream_fd(identifier, priority = LOG_INFO, level_pref
}

try {
GLib.unix_set_fd_nonblocking(fd, false);
// BEGIN ESM
if (major > 45) {
const GLibUnix = Gi.require('GLibUnix', '2.0');
GLibUnix.set_fd_nonblocking(fd, false);
} else {
// END ESM
// eslint-disable-next-line indent
GLib.unix_set_fd_nonblocking(fd, false);
// BEGIN ESM
}
// END ESM
return fd;
} catch (ex) {
GLib.close(fd);
Expand Down

0 comments on commit 7a4606e

Please sign in to comment.