我已经编写了一个扩展来获取github中提出的最新PR。
当我从一个目录(repo 1)中只打开一个vscode实例时,扩展运行得很好,但如果我从另一个目录(repo 2)中打开另一个vscode实例并运行扩展,则会得到上一次运行(repo 1)的输出
无论我打开多少其他vscode实例并运行扩展,它们都会给出第一次运行的结果(repo 1)
这是我的分机。js公司
const vscode = require('vscode');
const cp = require('child_process');
function activate(context) {
console.log('Congratulations, extension "latest-pr" is now active!');
let disposable = vscode.commands.registerCommand(
'latest-pr.giveMeLatestPR',
function () {
vscode.window.withProgress(
{
location: vscode.ProgressLocation.Window,
cancellable: false,
title: 'Getting latest PR number',
},
async (progress) => {
progress.report({ increment: 0 });
await new Promise((res, rej) => {
cp.exec(
"git ls-remote origin 'pull/*/head' | awk '{print $2}' | awk -F '/' '{print $3}' | sort -n | tail -n1",
(err, stdout, stderr) => {
if (err) {
res();
console.log('latest-pr - ERROR: ' + err);
return;
}
if (stdout) {
res();
vscode.window.showInformationMessage(
`latest PR number is - ${stdout}`
);
return;
}
if (stderr) {
res();
console.log(`latest-pr - ERROR: ${stderr}`);
return;
}
if (stdout.length === 0) {
res();
vscode.window.showInformationMessage('No PR raised yet');
}
}
);
});
progress.report({ increment: 100 });
}
);
}
);
context.subscriptions.push(disposable);
}
function deactivate(context) {
for (const sub of context.subscriptions) {
try {
sub.dispose();
} catch (e) {
console.error(e);
}
}
}
请帮我确定问题,谢谢