Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Commit

Permalink
🐛 Prevent race condition in fsDisp CWD reader
Browse files Browse the repository at this point in the history
Fix #430
  • Loading branch information
GitSquared committed Feb 19, 2019
1 parent 283798d commit d520f7e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/classes/filesystem.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class FilesystemDisplay {
this.failed = false;
this._noTracking = false;
this._runNextTick = false;
this._reading = false;

this._timer = setInterval(() => {
if (this._runNextTick === true) {
Expand Down Expand Up @@ -132,7 +133,8 @@ class FilesystemDisplay {
};

this.readFS = async dir => {
if (this.failed === true) return false;
if (this.failed === true || this._reading) return false;
this._reading = true;
let tcwd = dir;
let content = await this._asyncFSwrapper.readdir(tcwd).catch(err => {
console.warn(err);
Expand Down Expand Up @@ -224,6 +226,7 @@ class FilesystemDisplay {

this.dirpath = tcwd;
this.render(this.cwd);
this._reading = false;
};

this.readDevices = async () => {
Expand Down

0 comments on commit d520f7e

Please sign in to comment.