Skip to content

Commit

Permalink
fix: add windowsHide: true in more places (#2262)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKless authored Sep 25, 2024
1 parent 67a4721 commit 1731bc9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
17 changes: 10 additions & 7 deletions apps/nxls-e2e/src/nxls-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class NxlsWrapper {
private readerErrorDisposable?: { dispose: () => void };
private pendingRequestMap = new Map<
number,
(message: ResponseMessage) => void
[(message: ResponseMessage) => void, NodeJS.Timeout]
>();
private pendingNotificationMap = new Map<
string,
Expand Down Expand Up @@ -102,16 +102,17 @@ export class NxlsWrapper {
res(new Error('nxls stopped'));
clearTimeout(timeout);
});
this.pendingRequestMap.forEach((res, key) =>
this.pendingRequestMap.forEach(([res, timeout], key) => {
res({
jsonrpc: '2.0',
id: key,
error: {
code: -32000,
message: 'nxls stopped',
},
})
);
});
clearTimeout(timeout);
});

this.readerDisposable?.dispose();
this.readerErrorDisposable?.dispose();
Expand Down Expand Up @@ -158,7 +159,7 @@ export class NxlsWrapper {
}, (customTimeoutMinutes ?? 3) * 60 * 1000);

const id = this.idCounter++;
this.pendingRequestMap.set(id, resolve);
this.pendingRequestMap.set(id, [resolve, timeout]);

const fullRequest = {
jsonrpc: '2.0',
Expand Down Expand Up @@ -236,9 +237,11 @@ export class NxlsWrapper {
}

if (isResponseMessage(message) && typeof message.id === 'number') {
const resolve = this.pendingRequestMap.get(message.id);
if (resolve) {
const requestAndTimeout = this.pendingRequestMap.get(message.id);
if (requestAndTimeout) {
const [resolve, timeout] = requestAndTimeout;
resolve(message);
clearTimeout(timeout);
this.pendingRequestMap.delete(message.id);
}
} else if (isNotificationMessage(message)) {
Expand Down
1 change: 1 addition & 0 deletions libs/language-server/workspace/src/lib/nx-stop-daemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ export async function nxStopDaemon(workspacePath: string, logger: Logger) {
);
execSync(`${packageManagerCommands.exec} nx daemon --stop`, {
cwd: workspacePath,
windowsHide: true,
});
}
9 changes: 8 additions & 1 deletion libs/vscode/add-dependency/src/lib/vscode-add-dependency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,14 @@ async function getWorkspaceAddFlag(
private?: boolean;
}>(join(workspacePath, 'package.json'));
if (pkgManager === 'yarn') {
const isYarnV1 = major(execSync('yarn --version').toString().trim()) === 1;
const isYarnV1 =
major(
execSync('yarn --version', {
windowsHide: true,
})
.toString()
.trim()
) === 1;
const isWorkspace =
!!pkgJson.private &&
!!pkgJson.workspaces &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export function getGithubSlugOrNull(): string | null {
try {
const gitRemote = execSync('git remote -v', {
stdio: 'pipe',
windowsHide: true,
}).toString();
// If there are no remotes, we default to github
if (!gitRemote || gitRemote.length === 0) {
Expand Down

0 comments on commit 1731bc9

Please sign in to comment.