File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 5
5
"flag"
6
6
"fmt"
7
7
"os"
8
- "os/signal"
9
8
"runtime"
10
- "syscall"
11
9
12
10
"github.com/microsoft/typescript-go/internal/bundled"
13
11
"github.com/microsoft/typescript-go/internal/core"
@@ -17,7 +15,7 @@ import (
17
15
"github.com/microsoft/typescript-go/internal/vfs/osvfs"
18
16
)
19
17
20
- func runLSP (args []string ) int {
18
+ func runLSP (ctx context. Context , args []string ) int {
21
19
flag := flag .NewFlagSet ("lsp" , flag .ContinueOnError )
22
20
stdio := flag .Bool ("stdio" , false , "use stdio for communication" )
23
21
pprofDir := flag .String ("pprofDir" , "" , "Generate pprof CPU/memory profiles to the given directory." )
@@ -40,9 +38,6 @@ func runLSP(args []string) int {
40
38
defer profileSession .Stop ()
41
39
}
42
40
43
- ctx , stop := signal .NotifyContext (context .Background (), os .Interrupt , syscall .SIGTERM )
44
- defer stop ()
45
-
46
41
fs := bundled .WrapFS (osvfs .FS ())
47
42
defaultLibraryPath := bundled .LibPath ()
48
43
typingsLocation := getGlobalTypingsCacheLocation ()
Original file line number Diff line number Diff line change 1
1
package main
2
2
3
3
import (
4
+ "context"
4
5
"os"
6
+ "os/signal"
7
+ "syscall"
5
8
6
9
"github.com/microsoft/typescript-go/internal/execute"
7
10
)
@@ -11,11 +14,14 @@ func main() {
11
14
}
12
15
13
16
func runMain () int {
17
+ ctx , cancel := signal .NotifyContext (context .Background (), os .Interrupt , syscall .SIGTERM )
18
+ defer cancel ()
19
+
14
20
args := os .Args [1 :]
15
21
if len (args ) > 0 {
16
22
switch args [0 ] {
17
23
case "--lsp" :
18
- return runLSP (args [1 :])
24
+ return runLSP (ctx , args [1 :])
19
25
case "--api" :
20
26
return runAPI (args [1 :])
21
27
}
You can’t perform that action at this time.
0 commit comments