本文整理汇总了TypeScript中Process.exit函数的典型用法代码示例。如果您正苦于以下问题:TypeScript exit函数的具体用法?TypeScript exit怎么用?TypeScript exit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了exit函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: main
export async function main() {
try {
let action = process.argv[2];
if (action == null)
action = "help";
console.log(action);
let func = actions[action] || exports[action] as Function;
await func();
process.exit(0);
}
catch (err) {
console.log(err);
process.exit(1);
}
}
开发者ID:danelkhen,项目名称:desktopbrowser,代码行数:15,代码来源:run.ts
示例2: catch
worker.on('message', (message: Message) => {
// set result from worker
result.set(worker.pid, {
diagnostics: message.diagnostics.map(NormalizedMessage.createFromJSON),
lints: message.lints.map(NormalizedMessage.createFromJSON)
});
// if we have result from all workers, send merged
if (result.hasAll()) {
const merged: Message = result.reduce(
(innerMerged: Message, innerResult: Message) => ({
diagnostics: innerMerged.diagnostics.concat(innerResult.diagnostics),
lints: innerMerged.lints.concat(innerResult.lints)
}),
{ diagnostics: [], lints: [] }
);
merged.diagnostics = NormalizedMessage.deduplicate(merged.diagnostics);
merged.lints = NormalizedMessage.deduplicate(merged.lints);
try {
process.send(merged);
} catch (e) {
// channel closed...
process.exit();
}
}
});
开发者ID:livechat,项目名称:fork-ts-checker-webpack-plugin,代码行数:28,代码来源:cluster.ts
示例3: run
function run(cancellationToken: CancellationToken) {
let diagnostics: NormalizedMessage[] = [];
let lints: NormalizedMessage[] = [];
checker.nextIteration();
try {
diagnostics = checker.getDiagnostics(cancellationToken);
if (checker.hasLinter()) {
lints = checker.getLints(cancellationToken);
}
} catch (error) {
if (error instanceof ts.OperationCanceledException) {
return;
}
throw error;
}
if (!cancellationToken.isCancellationRequested()) {
try {
process.send({
diagnostics,
lints
});
} catch (e) {
// channel closed...
process.exit();
}
}
}
开发者ID:livechat,项目名称:fork-ts-checker-webpack-plugin,代码行数:31,代码来源:service.ts
示例4: exit
.catch(exception => {
const message = options.debug
? chalk.red(exception.stack)
: chalk.red(exception.message) + ' (use --debug to see a full stack trace)';
log.error(`Failed to render application: ${message}`);
exit(1);
});
开发者ID:sonukapoor,项目名称:angular-ssr,代码行数:9,代码来源:render.ts
示例5: test
async function test() {
let pong = await db.ping();
console.log(pong);
pong = await db.ping();
console.log(pong);
pong = await db.ping();
console.log(pong);
pong = await db.ping();
console.log(pong);
process.exit()
}
开发者ID:mmtrade,项目名称:tectonicdb,代码行数:11,代码来源:test.ts
示例6: exit
app.use((req, res, next) => {
console.log(req.url);
if (req.url === '/robots.txt') {
return;
}
if (req.url === '/integration/favicon.ico') {
return;
}
if (req.url === '/test/exit') {
res.send('exit');
exit(0);
return;
}
next();
});
开发者ID:LucasFrecia,项目名称:store,代码行数:17,代码来源:server.ts
示例7:
() => {
if (unknownCountriesMap.length) {
console.info(`\nOne or more Wiki pages has an unrecognised visa status. This could be due to
* A typo in the Wiki page
* A new visa status term not expected by the Wiki parser (Refer: https://github.com/vinaygopinath/visa-req-wiki-scraper/blob/master/utils/wiki.ts#L15
* A newly introduced visa status`);
unknownCountriesMap.forEach((it) => {
console.error(`\n${it.parentCountry} wiki page`);
it.unknownCountries.forEach((itt) => {
console.error(`Name: ${itt.name}\tVisa: ${itt.visa || 'N/A'}\tNote: ${itt.note || 'N/A'}`);
});
});
console.error('\nWiki scraper failed');
process.exit(1);
} else {
console.info('\nAll Wiki pages processed successfully');
}
}
开发者ID:vinaygopinath,项目名称:visa-req-wiki-scraper,代码行数:18,代码来源:index.ts
示例8:
process.on('SIGINT', () => {
process.exit();
});
开发者ID:livechat,项目名称:fork-ts-checker-webpack-plugin,代码行数:3,代码来源:cluster.ts
示例9: readFile
(async () => {
let countries: CountryInput[] | null = null;
try {
const countriesStr = await readFile('./input/countries.json', 'utf8');
countries = JSON.parse(countriesStr);
} catch (ex) {
console.error('Could not load list of countries. Check if countries.json exists and ensure that it is valid JSON');
}
if (!countries) {
process.exit(1);
}
const unknownCountriesMap: { parentCountry: string, unknownCountries: CountryOutput[] }[] = [];
BluebirdPromise.map(countries as CountryInput[], async (country: CountryInput) => {
const countryData = await WikiUtil.scrapeCountryData(country.demonym);
console.info(`\n\n****\nVisa requirements for ${country.demonym} citizens`);
const wikiUrl = `http://en.wikipedia.org/wiki/Visa_requirements_for_${WikiUtil.capitalize(country.demonym)}_citizens`;
console.info(`Wiki URL = ${wikiUrl}`);
console.info(`\n${country.name} stats:\n`);
let total = 0;
for (const visaReq in VisaRequirement) { // tslint:disable-line
const countryOutput: CountryOutput[] = countryData[WikiUtil.camelCaseVisaRequirement(VisaRequirement[visaReq])];
console.info(`${visaReq}: ${countryOutput.length}`);
total += countryOutput.length;
if (VisaRequirement[visaReq] === VisaRequirement.UNKNOWN && countryOutput.length) {
unknownCountriesMap.push({ parentCountry: country.name, unknownCountries: countryOutput });
}
}
console.info(`TOTAL: ${total}`);
countryData[WikiUtil.camelCaseVisaRequirement(VisaRequirement.NOT_REQUIRED)].push(new CountryOutput(country.name, null, 'home'));
return FileUtil.writeToFile(country.name, countryData);
}, { concurrency: CONCURRENT_SCRAPE_INSTANCES })
.then(
() => {
if (unknownCountriesMap.length) {
console.info(`\nOne or more Wiki pages has an unrecognised visa status. This could be due to
* A typo in the Wiki page
* A new visa status term not expected by the Wiki parser (Refer: https://github.com/vinaygopinath/visa-req-wiki-scraper/blob/master/utils/wiki.ts#L15
* A newly introduced visa status`);
unknownCountriesMap.forEach((it) => {
console.error(`\n${it.parentCountry} wiki page`);
it.unknownCountries.forEach((itt) => {
console.error(`Name: ${itt.name}\tVisa: ${itt.visa || 'N/A'}\tNote: ${itt.note || 'N/A'}`);
});
});
console.error('\nWiki scraper failed');
process.exit(1);
} else {
console.info('\nAll Wiki pages processed successfully');
}
}
);
})();
开发者ID:vinaygopinath,项目名称:visa-req-wiki-scraper,代码行数:62,代码来源:index.ts
注:本文中的Process.exit函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论