Skip to content

Commit

Permalink
ensure that console.warn and console.debug hit debug.log and that rep…
Browse files Browse the repository at this point in the history
…o.lock is removed if it exists on startup
  • Loading branch information
jdeepee committed Oct 8, 2021
1 parent 1a203fe commit fe7033a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/main-thread/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ export function setup(mainThreadState: MainThreadGlobal): void {
log_stdout.write(util.format(arg) + "\n");
});
};
console.warn = function (...args: any) {
args.forEach((arg: any) => {
log_file.write(util.format(arg) + "\n");
log_stdout.write(util.format(arg) + "\n");
});
};
console.debug = function (...args: any) {
args.forEach((arg: any) => {
log_file.write(util.format(arg) + "\n");
log_stdout.write(util.format(arg) + "\n");
});
};
} else {
console.log("\x1b[1m", "App is running in dev mode", "\x1b[0m", "\n");

Expand All @@ -74,4 +86,10 @@ export function setup(mainThreadState: MainThreadGlobal): void {
app.setPath("userData", path.join(app.getPath("userData"), "dev"));
app.setPath("appData", path.join(app.getPath("appData"), "junto", "dev"));
}
const repoLockPath = path.join(app.getPath("appData"), ".jsipfs/repo.lock");
console.debug("repo lock path", repoLockPath);
if (fs.existsSync(repoLockPath)) {
console.log("\x1b[31m", "\n\nFound repo.lock, deleting!");
fs.rmSync(repoLockPath);
}
}

0 comments on commit fe7033a

Please sign in to comment.