mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-09-22 17:16:19 -07:00
27 lines
883 B
JavaScript
27 lines
883 B
JavaScript
import fs from 'node:fs';
|
|
import os from 'node:os';
|
|
import path from 'node:path';
|
|
import { spawnSync } from 'node:child_process';
|
|
import { createRequire } from 'node:module';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
const require = createRequire(import.meta.url);
|
|
const profile = fs.mkdtempSync(path.join(os.tmpdir(), 'subminer-hachi-settings-'));
|
|
const env = { ...process.env, SUBMINER_DICTIONARY_SMOKE_DATA: profile };
|
|
delete env.ELECTRON_RUN_AS_NODE;
|
|
try {
|
|
const result = spawnSync(
|
|
require('electron'),
|
|
[
|
|
'--no-sandbox',
|
|
fileURLToPath(new URL('./check-dictionary-backends.cjs', import.meta.url)),
|
|
...process.argv.slice(2),
|
|
],
|
|
{ env, stdio: 'inherit', timeout: 75_000 },
|
|
);
|
|
if (result.error) throw result.error;
|
|
process.exitCode = result.status ?? 1;
|
|
} finally {
|
|
fs.rmSync(profile, { recursive: true, force: true, maxRetries: 3 });
|
|
}
|