Run daemon on packaged Bare runtime
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
import { access } from 'node:fs/promises';
|
||||
import { constants } from 'node:fs';
|
||||
import { execFile } from 'node:child_process';
|
||||
import { promisify } from 'node:util';
|
||||
import { spawn } from 'node:child_process';
|
||||
|
||||
const run = promisify(execFile);
|
||||
const run = (file, args) => new Promise((resolve, reject) => {
|
||||
const child = spawn(file, args, { stdio: ['ignore', 'pipe', 'pipe'] });
|
||||
let stdout = ''; let stderr = '';
|
||||
child.stdout?.on('data', (chunk) => { stdout += chunk; });
|
||||
child.stderr?.on('data', (chunk) => { stderr += chunk; });
|
||||
child.once('error', reject);
|
||||
child.once('close', (code) => code === 0 ? resolve({ stdout, stderr }) : reject(new Error(stderr || `${file} exited ${code}`)));
|
||||
});
|
||||
const checks = [
|
||||
['session', false, async () => process.env.XDG_SESSION_TYPE || 'unknown'],
|
||||
['portal', false, async () => { await access('/usr/share/dbus-1/services/org.freedesktop.portal.Desktop.service', constants.F_OK); return 'installed'; }],
|
||||
|
||||
Reference in New Issue
Block a user