当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript ps.listProcesses函数代码示例

本文整理汇总了TypeScript中vs/base/node/ps.listProcesses函数的典型用法代码示例。如果您正苦于以下问题:TypeScript listProcesses函数的具体用法?TypeScript listProcesses怎么用?TypeScript listProcesses使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了listProcesses函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: getDiagnostics

	async getDiagnostics(launchService: ILaunchService): Promise<string> {
		const output: string[] = [];
		const info = await launchService.getMainProcessInfo();
		return listProcesses(info.mainPID).then(async rootProcess => {

			// Environment Info
			output.push('');
			output.push(this.formatEnvironment(info));

			// Process List
			output.push('');
			output.push(this.formatProcessList(info, rootProcess));

			// Workspace Stats
			if (info.windows.some(window => window.folderURIs && window.folderURIs.length > 0 && !window.remoteAuthority)) {
				output.push('');
				output.push('Workspace Stats: ');
				output.push(await this.formatWorkspaceMetadata(info));
			}

			try {
				const data = await launchService.getRemoteDiagnostics({ includeProcesses: true, includeWorkspaceMetadata: true });
				data.forEach(diagnostics => {
					if (isRemoteDiagnosticError(diagnostics)) {
						output.push(`\n${diagnostics.errorMessage}`);
					} else {
						output.push('\n\n');
						output.push(`Remote:           ${diagnostics.hostName}`);
						output.push(this.formatMachineInfo(diagnostics.machineInfo));

						if (diagnostics.processes) {
							output.push(this.formatProcessList(info, diagnostics.processes));
						}

						if (diagnostics.workspaceMetadata) {
							for (const folder of Object.keys(diagnostics.workspaceMetadata)) {
								const metadata = diagnostics.workspaceMetadata[folder];

								let countMessage = `${metadata.fileCount} files`;
								if (metadata.maxFilesReached) {
									countMessage = `more than ${countMessage}`;
								}

								output.push(`Folder (${folder}): ${countMessage}`);
								output.push(this.formatWorkspaceStats(metadata));
							}
						}
					}
				});
			} catch (e) {
				output.push('\n\n');
				output.push(`Fetching status information from remotes failed: ${e.message}`);
			}

			output.push('');
			output.push('');

			return output.join('\n');
		});
	}
开发者ID:PKRoma,项目名称:vscode,代码行数:60,代码来源:diagnosticsService.ts

示例2: printDiagnostics

	printDiagnostics(info: IMainProcessInfo): Promise<any> {
		return listProcesses(info.mainPID).then(rootProcess => {

			// Environment Info
			console.log('');
			console.log(this.formatEnvironment(info));

			// Process List
			console.log('');
			console.log(this.formatProcessList(info, rootProcess));

			// Workspace Stats
			const workspaceStatPromises = [];
			if (info.windows.some(window => window.folderURIs && window.folderURIs.length > 0)) {
				console.log('');
				console.log('Workspace Stats: ');
				info.windows.forEach(window => {
					if (window.folderURIs.length === 0) {
						return;
					}

					console.log(`|  Window (${window.title})`);

					window.folderURIs.forEach(uriComponents => {
						const folderUri = URI.revive(uriComponents);
						if (folderUri.scheme === 'file') {
							const folder = folderUri.fsPath;
							workspaceStatPromises.push(collectWorkspaceStats(folder, ['node_modules', '.git']).then(async stats => {
								let countMessage = `${stats.fileCount} files`;
								if (stats.maxFilesReached) {
									countMessage = `more than ${countMessage}`;
								}
								console.log(`|    Folder (${basename(folder)}): ${countMessage}`);
								console.log(this.formatWorkspaceStats(stats));

								await collectLaunchConfigs(folder).then(launchConfigs => {
									if (launchConfigs.length > 0) {
										console.log(this.formatLaunchConfigs(launchConfigs));
									}
								});
							}).catch(error => {
								console.log(`|      Error: Unable to collect workspace stats for folder ${folder} (${error.toString()})`);
							}));
						} else {
							console.log(`|    Folder (${folderUri.toString()}): Workspace stats not available.`);
						}
					});
				});
			}

			return Promise.all(workspaceStatPromises).then(() => {
				console.log('');
				console.log('');
			});
		});
	}
开发者ID:DonJayamanne,项目名称:vscode,代码行数:56,代码来源:diagnosticsService.ts

示例3: setInterval

	setInterval(() => listProcesses(remote.process.pid).then(processes => {
		processList = getProcessList(processes);
		updateProcessInfo(processList);

		const tableRows = document.getElementsByTagName('tr');
		for (let i = 0; i < tableRows.length; i++) {
			const tableRow = tableRows[i];
			tableRow.addEventListener('contextmenu', (e) => {
				showContextMenu(e);
			});
		}
	}), 1200);
开发者ID:jumpinjackie,项目名称:sqlopsstudio,代码行数:12,代码来源:processExplorerMain.ts

示例4: getPerformanceInfo

	getPerformanceInfo(info: IMainProcessInfo): Promise<PerformanceInfo> {
		return listProcesses(info.mainPID).then(rootProcess => {
			const workspaceInfoMessages = [];

			// Workspace Stats
			const workspaceStatPromises = [];
			if (info.windows.some(window => window.folderURIs && window.folderURIs.length > 0)) {
				info.windows.forEach(window => {
					if (window.folderURIs.length === 0) {
						return;
					}

					workspaceInfoMessages.push(`|  Window (${window.title})`);

					window.folderURIs.forEach(uriComponents => {
						const folderUri = URI.revive(uriComponents);
						if (folderUri.scheme === 'file') {
							const folder = folderUri.fsPath;
							workspaceStatPromises.push(collectWorkspaceStats(folder, ['node_modules', '.git']).then(async stats => {

								let countMessage = `${stats.fileCount} files`;
								if (stats.maxFilesReached) {
									countMessage = `more than ${countMessage}`;
								}
								workspaceInfoMessages.push(`|    Folder (${basename(folder)}): ${countMessage}`);
								workspaceInfoMessages.push(this.formatWorkspaceStats(stats));

								const launchConfigs = await collectLaunchConfigs(folder);
								if (launchConfigs.length > 0) {
									workspaceInfoMessages.push(this.formatLaunchConfigs(launchConfigs));
								}
							}));
						} else {
							workspaceInfoMessages.push(`|    Folder (${folderUri.toString()}): RPerformance stats not available.`);
						}
					});
				});
			}

			return Promise.all(workspaceStatPromises).then(() => {
				return {
					processInfo: this.formatProcessList(info, rootProcess),
					workspaceInfo: workspaceInfoMessages.join('\n')
				};
			}).catch(error => {
				return {
					processInfo: this.formatProcessList(info, rootProcess),
					workspaceInfo: `Unable to calculate workspace stats: ${error}`
				};
			});
		});
	}
开发者ID:DonJayamanne,项目名称:vscode,代码行数:52,代码来源:diagnosticsService.ts

示例5: setInterval

	setInterval(() => {
		ipcRenderer.send('windowsInfoRequest');

		listProcesses(data.pid).then(processes => {
			processList = getProcessList(processes);
			updateProcessInfo(processList);

			const tableRows = document.getElementsByTagName('tr');
			for (let i = 0; i < tableRows.length; i++) {
				const tableRow = tableRows[i];
				tableRow.addEventListener('contextmenu', (e) => {
					showContextMenu(e);
				});
			}
		});
	}, 1200);
开发者ID:KTXSoftware,项目名称:KodeStudio,代码行数:16,代码来源:processExplorerMain.ts

示例6: printDiagnostics

export function printDiagnostics(info: IMainProcessInfo): Promise<any> {
	return listProcesses(info.mainPID).then(rootProcess => {

		// Environment Info
		console.log('');
		console.log(formatEnvironment(info));

		// Process List
		console.log('');
		console.log(formatProcessList(info, rootProcess));

		// Workspace Stats
		if (info.windows.some(window => window.folders && window.folders.length > 0)) {
			console.log('');
			console.log('Workspace Stats: ');
			info.windows.forEach(window => {
				if (window.folders.length === 0) {
					return;
				}

				console.log(`|  Window (${window.title})`);

				window.folders.forEach(folder => {
					try {
						const stats = collectWorkspaceStats(folder, ['node_modules', '.git']);
						let countMessage = `${stats.fileCount} files`;
						if (stats.maxFilesReached) {
							countMessage = `more than ${countMessage}`;
						}
						console.log(`|    Folder (${basename(folder)}): ${countMessage}`);
						console.log(formatWorkspaceStats(stats));

						const launchConfigs = collectLaunchConfigs(folder);
						if (launchConfigs.length > 0) {
							console.log(formatLaunchConfigs(launchConfigs));
						}
					} catch (error) {
						console.log(`|      Error: Unable to collect workpsace stats for folder ${folder} (${error.toString()})`);
					}
				});
			});
		}
		console.log('');
		console.log('');
	});
}
开发者ID:costincaraivan,项目名称:vscode,代码行数:46,代码来源:diagnostics.ts

示例7: getPerformanceInfo

export function getPerformanceInfo(info: IMainProcessInfo): Promise<PerformanceInfo> {
	return listProcesses(info.mainPID).then(rootProcess => {
		const workspaceInfoMessages = [];

		// Workspace Stats
		const workspaceStatPromises = [];
		if (info.windows.some(window => window.folders && window.folders.length > 0)) {
			info.windows.forEach(window => {
				if (window.folders.length === 0) {
					return;
				}

				workspaceInfoMessages.push(`|  Window (${window.title})`);

				window.folders.forEach(folder => {
					workspaceStatPromises.push(collectWorkspaceStats(folder, ['node_modules', '.git']).then(async stats => {

						let countMessage = `${stats.fileCount} files`;
						if (stats.maxFilesReached) {
							countMessage = `more than ${countMessage}`;
						}
						workspaceInfoMessages.push(`|    Folder (${basename(folder)}): ${countMessage}`);
						workspaceInfoMessages.push(formatWorkspaceStats(stats));

						const launchConfigs = await collectLaunchConfigs(folder);
						if (launchConfigs.length > 0) {
							workspaceInfoMessages.push(formatLaunchConfigs(launchConfigs));
						}
					}));
				});
			});
		}

		return Promise.all(workspaceStatPromises).then(() => {
			return {
				processInfo: formatProcessList(info, rootProcess),
				workspaceInfo: workspaceInfoMessages.join('\n')
			};
		}).catch(error => {
			return {
				processInfo: formatProcessList(info, rootProcess),
				workspaceInfo: `Unable to calculate workspace stats: ${error}`
			};
		});
	});
}
开发者ID:AllureFer,项目名称:vscode,代码行数:46,代码来源:diagnostics.ts

示例8: getPerformanceInfo

	async getPerformanceInfo(launchService: ILaunchService): Promise<PerformanceInfo> {
		const info = await launchService.getMainProcessInfo();
		return Promise.all<ProcessItem, string>([listProcesses(info.mainPID), this.formatWorkspaceMetadata(info)]).then(async result => {
			let [rootProcess, workspaceInfo] = result;
			let processInfo = this.formatProcessList(info, rootProcess);

			try {
				const remoteData = await launchService.getRemoteDiagnostics({ includeProcesses: true, includeWorkspaceMetadata: true });
				remoteData.forEach(diagnostics => {
					if (isRemoteDiagnosticError(diagnostics)) {
						processInfo += `\n${diagnostics.errorMessage}`;
						workspaceInfo += `\n${diagnostics.errorMessage}`;
					} else {
						processInfo += `\n\nRemote: ${diagnostics.hostName}`;
						if (diagnostics.processes) {
							processInfo += `\n${this.formatProcessList(info, diagnostics.processes)}`;
						}

						if (diagnostics.workspaceMetadata) {
							workspaceInfo += `\n|  Remote: ${diagnostics.hostName}`;
							for (const folder of Object.keys(diagnostics.workspaceMetadata)) {
								const metadata = diagnostics.workspaceMetadata[folder];

								let countMessage = `${metadata.fileCount} files`;
								if (metadata.maxFilesReached) {
									countMessage = `more than ${countMessage}`;
								}

								workspaceInfo += `|    Folder (${folder}): ${countMessage}`;
								workspaceInfo += this.formatWorkspaceStats(metadata);
							}
						}
					}
				});
			} catch (e) {
				processInfo += `\nFetching remote data failed: ${e}`;
				workspaceInfo += `\nFetching remote data failed: ${e}`;
			}

			return {
				processInfo,
				workspaceInfo
			};
		});
	}
开发者ID:PKRoma,项目名称:vscode,代码行数:45,代码来源:diagnosticsService.ts

示例9: buildDiagnostics

export function buildDiagnostics(info: IMainProcessInfo): Promise<DiagnosticInfo> {
	return listProcesses(info.mainPID).then(rootProcess => {
		const workspaceInfoMessages = [];

		// Workspace Stats
		if (info.windows.some(window => window.folders && window.folders.length > 0)) {
			info.windows.forEach(window => {
				if (window.folders.length === 0) {
					return;
				}

				workspaceInfoMessages.push(`|  Window (${window.title})`);

				window.folders.forEach(folder => {
					try {
						const stats = collectWorkspaceStats(folder, ['node_modules', '.git']);
						let countMessage = `${stats.fileCount} files`;
						if (stats.maxFilesReached) {
							countMessage = `more than ${countMessage}`;
						}
						workspaceInfoMessages.push(`|    Folder (${basename(folder)}): ${countMessage}`);
						workspaceInfoMessages.push(formatWorkspaceStats(stats));

						const launchConfigs = collectLaunchConfigs(folder);
						if (launchConfigs.length > 0) {
							workspaceInfoMessages.push(formatLaunchConfigs(launchConfigs));
						}
					} catch (error) {
						workspaceInfoMessages.push(`|      Error: Unable to collect workpsace stats for folder ${folder} (${error.toString()})`);
					}
				});
			});
		}

		return {
			versionInfo: getVersionInfo(),
			systemInfo: getSystemInfo(info),
			processInfo: getProcessList(info, rootProcess),
			workspaceInfo: workspaceInfoMessages.join('\n')
		};
	});
}
开发者ID:jamesforest,项目名称:vscode,代码行数:42,代码来源:diagnostics.ts


注:本文中的vs/base/node/ps.listProcesses函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。