本文整理汇总了TypeScript中fb-watchman.Client.end方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Client.end方法的具体用法?TypeScript Client.end怎么用?TypeScript Client.end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fb-watchman.Client
的用法示例。
在下文中一共展示了Client.end方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: watchmanCrawl
//.........这里部分代码省略.........
const response = await cmd('query', root, query);
if ('warning' in response) {
console.warn('watchman warning: ', response.warning);
}
isFresh = isFresh || response.is_fresh_instance;
files.set(root, response);
},
),
);
return {
files,
isFresh,
};
}
let files = data.files;
let watchmanFiles: Map<string, any>;
try {
const watchmanRoots = await getWatchmanRoots(roots);
const watchmanFileResults = await queryWatchmanForDirs(watchmanRoots);
// Reset the file map if watchman was restarted and sends us a list of
// files.
if (watchmanFileResults.isFresh) {
files = new Map();
}
watchmanFiles = watchmanFileResults.files;
} finally {
client.end();
}
if (clientError) {
throw clientError;
}
// TODO: remove non-null
for (const [watchRoot, response] of watchmanFiles!) {
const fsRoot = normalizePathSep(watchRoot);
const relativeFsRoot = fastPath.relative(rootDir, fsRoot);
clocks.set(relativeFsRoot, response.clock);
for (const fileData of response.files) {
const filePath = fsRoot + path.sep + normalizePathSep(fileData.name);
const relativeFilePath = fastPath.relative(rootDir, filePath);
if (!fileData.exists) {
files.delete(relativeFilePath);
} else if (!ignore(filePath)) {
const mtime =
typeof fileData.mtime_ms === 'number'
? fileData.mtime_ms
: fileData.mtime_ms.toNumber();
const size = fileData.size;
let sha1hex = fileData['content.sha1hex'];
if (typeof sha1hex !== 'string' || sha1hex.length !== 40) {
sha1hex = null;
}
const existingFileData = data.files.get(relativeFilePath);
let nextData: FileMetaData;
示例2:
client.capabilityCheck({ optional: [], required: ['relative_root'] }, e => {
if (e) {
client.end();
return;
}
});