提交 a4b8d073 编写于 作者: D Dirk Baeumer

Fixes #39663: code --status doesn't work on Windows

上级 a20a578c
......@@ -126,9 +126,9 @@ export function listProcesses(rootPid: number): Promise<ProcessItem> {
type Item = ProcessInfo | TopProcess;
const execMain = path.basename(process.execPath);
const script = URI.parse(require.toUrl('vs/base/node/ps-win.ps1')).fsPath;
const commandLine = `${script} -ProcessName '${execMain}' -MaxSamples 3`;
const execMain = path.basename(process.execPath).replace(/ /g, '` ');
const script = URI.parse(require.toUrl('vs/base/node/ps-win.ps1')).fsPath.replace(/ /g, '` ');
const commandLine = `${script} -ProcessName ${execMain} -MaxSamples 3`;
const cmd = spawn('powershell.exe', ['-ExecutionPolicy', 'Bypass', '-Command', commandLine]);
let stdout = '';
......@@ -151,10 +151,14 @@ export function listProcesses(rootPid: number): Promise<ProcessItem> {
for (const item of items) {
if (item.type === 'processInfo') {
let load = 0;
for (let value of item.cpuLoad) {
load += value;
if (item.cpuLoad) {
for (let value of item.cpuLoad) {
load += value;
}
load = load / item.cpuLoad.length;
} else {
load = -1;
}
load = load / item.cpuLoad.length;
processItems.set(item.processId, {
name: findName(item.commandLine),
cmd: item.commandLine,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册