fix: use async file methods

pull/3145/head
yougotwill 8 months ago
parent 35633cce94
commit 9468c26fb8

@ -54,8 +54,10 @@ export const AboutView = () => {
}
const versionInfo = `v${window.getVersion()}`;
const systemInfo = `${window.i18n('systemInformationDesktop', [window.getOSRelease()])}`;
const commitInfo = `${window.i18n('commitHashDesktop', [window.getCommitHash() || window.i18n('unknown')])}`;
const systemInfo = window.i18n('systemInformationDesktop', [window.getOSRelease()]);
const commitInfo = window.i18n('commitHashDesktop', [
window.getCommitHash() || window.i18n('unknown'),
]);
useEffect(() => {
if (window.theme) {

@ -20,6 +20,7 @@ import {
import crypto from 'crypto';
import fs from 'fs';
import { copyFile, appendFile } from 'node:fs/promises';
import os from 'os';
import path, { join } from 'path';
import { platform as osPlatform } from 'process';
@ -671,12 +672,12 @@ async function saveDebugLog(_event: any, additionalInfo: string) {
throw Error('No logger file path');
}
fs.copyFileSync(loggerFilePath, outputPath);
await copyFile(loggerFilePath, outputPath);
console.info(`[log] Copied logs to ${outputPath} from ${loggerFilePath}`);
// append any additional info
if (additionalInfo) {
fs.appendFileSync(outputPath, additionalInfo, { encoding: 'utf-8' });
await appendFile(outputPath, additionalInfo, { encoding: 'utf-8' });
console.info(`[log] Saved additional info to logs ${outputPath} from ${loggerFilePath}`);
}
} catch (err) {

Loading…
Cancel
Save