Yarn start is hanging

Summary: Fixed hanging on "yarn start"

Reviewed By: passy, cekkaewnumchai

Differential Revision: D20158451

fbshipit-source-id: 0aa834e33ce622cc264005d0648546608f208d07
This commit is contained in:
Anton Nikolaev
2020-02-28 04:06:25 -08:00
committed by Facebook Github Bot
parent 74e1376089
commit 58225fe113
7 changed files with 47 additions and 45 deletions

View File

@@ -8,7 +8,7 @@
*/
import {Client} from 'fb-watchman';
import uuid from 'uuid';
import {v4 as uuid} from 'uuid';
import path from 'path';
export default class Watchman {
@@ -76,35 +76,39 @@ export default class Watchman {
return reject(error);
}
const {clock} = resp;
try {
const {clock} = resp;
const sub = {
expression: [
'allof',
['not', ['type', 'd']],
...options!.excludes.map(e => ['not', ['match', e, 'wholename']]),
],
fields: ['name'],
since: clock,
relative_root: this.relativeRoot
? path.join(this.relativeRoot, relativeDir)
: relativeDir,
};
const sub = {
expression: [
'allof',
['not', ['type', 'd']],
...options!.excludes.map(e => ['not', ['match', e, 'wholename']]),
],
fields: ['name'],
since: clock,
relative_root: this.relativeRoot
? path.join(this.relativeRoot, relativeDir)
: relativeDir,
};
const id = uuid.v4();
const id = uuid();
this.client!.command(['subscribe', this.watch, id, sub], error => {
if (error) {
return reject(error);
}
this.client!.on('subscription', resp => {
if (resp.subscription !== id || !resp.files) {
return;
this.client!.command(['subscribe', this.watch, id, sub], error => {
if (error) {
return reject(error);
}
handler(resp);
this.client!.on('subscription', resp => {
if (resp.subscription !== id || !resp.files) {
return;
}
handler(resp);
});
resolve();
});
resolve();
});
} catch (err) {
reject(err);
}
});
});
}