Skip to content

Commit

Permalink
Clean up log files.
Browse files Browse the repository at this point in the history
  • Loading branch information
minerjed committed Dec 30, 2023
1 parent d690de0 commit df4fba2
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 68 deletions.
108 changes: 54 additions & 54 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 8 additions & 13 deletions workspaces/angular-xcash-app/src/app/services/rpc-calls.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,20 +352,15 @@ export class RpcCallsService {
APIs.exec("killall -9 'xcash-wallet-rpc-linux'");
}
await new Promise(resolve => setTimeout(resolve, 10000));
// Cleanup
if (fs.existsSync(IMPORT_WALLET_FILE)) {
fs.unlinkSync(IMPORT_WALLET_FILE);
}
if (fs.existsSync(rpclog)) {
fs.unlinkSync(rpclog);
}
for (let i = 1; i <= 10; i++) {
try {
if (fs.existsSync(`${wdir}xcash-wallet-rpc.log-part-${i}`)) {
fs.unlinkSync(`${wdir}xcash-wallet-rpc.log-part-${i}`);
// Cleanup logs
try {
const files = fs.readdirSync(wdir);
files.forEach((file: any) => {
if (file.startsWith('xcash-wallet-rpc')) {
fs.unlinkSync(`${wdir}${file}`);
}
} catch (err) {
}
});
} catch (err) {
}
await new Promise(resolve => setTimeout(resolve, 5000));
const rpccommand: string = `${rpcexe} --rpc-bind-port 18285 --disable-rpc-login --log-level 2 --log-file ${rpclog} --wallet-dir ${wdir} --daemon-address ${rnode} --rpc-user-agent ${rpcUserAgent}`;
Expand Down
3 changes: 2 additions & 1 deletion workspaces/electron-xcash-app/renderer/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ contextBridge.exposeInMainWorld('electronFs', {
unlinkSync: fs.unlinkSync,
renameSync: fs.renameSync,
writeFileSync: fs.writeFileSync,
existsSync: fs.existsSync
existsSync: fs.existsSync,
readdirSync: fs.readdirSync
});

contextBridge.exposeInMainWorld('electronAPIs', {
Expand Down
1 change: 1 addition & 0 deletions workspaces/shared-lib/apis/window-electronFs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export interface WindowElectronFs {
renameSync(oldPath: string, newPath: string): void;
writeFileSync(filePath: string, data: string | Buffer, options?: { encoding?: string | null; mode?: number | string; flag?: string; }): void;
existsSync(filePath: string) : boolean;
readdirSync(path: string): string[];
}

0 comments on commit df4fba2

Please sign in to comment.