Skip to content

Commit 1aa7af2

Browse files
committed
Set clangd log level instead of closing stderr in alsp
These errors are helpful, so let's not suppress them and hope that there aren't too many of them.
1 parent 59f9f10 commit 1aa7af2

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

bin/alsp.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -656,13 +656,8 @@ void spawn(char *argv[]) {
656656
close(fd0[1]);
657657
close(fd1[0]);
658658
close(fd1[1]);
659-
int fd = open("/dev/null", O_RDWR);
660-
if (fd != -1) {
661-
dup2(fd, 2);
662-
close(fd);
663-
}
664659
execvp(argv[0], argv);
665-
error(EXIT_FAILURE, errno, "exec");
660+
error(EXIT_FAILURE, errno, "exec: %s", argv[0]);
666661
}
667662
close(fd0[1]);
668663
close(fd1[0]);
@@ -722,7 +717,9 @@ void guessinvocation(void) {
722717
error(EXIT_FAILURE, 0, "Which server?");
723718
}
724719
char *argv[] = {(char *)server, NULL, NULL};
725-
if (strcmp(server, "pyright-langserver") == 0) {
720+
if (strcmp(server, "clangd") == 0) {
721+
argv[1] = "--log=error";
722+
} else if (strcmp(server, "pyright-langserver") == 0) {
726723
argv[1] = "--stdio";
727724
}
728725
spawn(argv);

0 commit comments

Comments
 (0)