@@ -3,6 +3,35 @@ require("./bootstrap");
3
3
import * as shelljs from "shelljs" ;
4
4
shelljs . config . silent = true ;
5
5
shelljs . config . fatal = true ;
6
+
7
+ if ( process . platform === "win32" ) {
8
+ // Later versions of shelljs do not process globs with \ path delimiters correctly, for windows change to /
9
+ const realcp = shelljs . cp ;
10
+ ( shelljs as any ) . cp = ( ...args : unknown [ ] ) => {
11
+ if ( args . length === 3 ) {
12
+ args [ 1 ] = replaceDashes ( args [ 1 ] as string | string [ ] ) ;
13
+ } else {
14
+ args [ 0 ] = replaceDashes ( args [ 0 ] as string | string [ ] ) ;
15
+ }
16
+
17
+ if ( args . length == 2 ) {
18
+ realcp ( args [ 0 ] as string [ ] , args [ 1 ] as string ) ;
19
+ } else {
20
+ realcp ( args [ 0 ] as string , args [ 1 ] as string [ ] , args [ 2 ] as string ) ;
21
+ }
22
+ } ;
23
+ function replaceDashes ( values : string | string [ ] ) : string | string [ ] {
24
+ if ( Array . isArray ( values ) ) {
25
+ for ( let i = 0 ; i < values . length ; ++ i ) {
26
+ values [ i ] = replaceDashes ( values [ i ] ) as string ;
27
+ }
28
+ return values ;
29
+ } else {
30
+ return values . replace ( / \\ / g, "/" ) ;
31
+ }
32
+ }
33
+ }
34
+
6
35
import { installUncaughtExceptionListener } from "./common/errors" ;
7
36
import { settlePromises } from "./common/helpers" ;
8
37
import { injector } from "./common/yok" ;
@@ -14,7 +43,7 @@ import {
14
43
import { IInitializeService } from "./definitions/initialize-service" ;
15
44
import { color } from "./color" ;
16
45
installUncaughtExceptionListener (
17
- process . exit . bind ( process , ErrorCodes . UNCAUGHT )
46
+ process . exit . bind ( process , ErrorCodes . UNCAUGHT ) ,
18
47
) ;
19
48
20
49
const logger : ILogger = injector . resolve ( "logger" ) ;
@@ -23,17 +52,17 @@ export const originalProcessOn = process.on.bind(process);
23
52
process . on = ( event : string , listener : any ) : any => {
24
53
if ( event === "SIGINT" ) {
25
54
logger . trace (
26
- `Trying to handle SIGINT event. CLI overrides this behavior and does not allow handling SIGINT as this causes issues with Ctrl + C in terminal.`
55
+ `Trying to handle SIGINT event. CLI overrides this behavior and does not allow handling SIGINT as this causes issues with Ctrl + C in terminal.` ,
27
56
) ;
28
57
const msg = "The stackTrace of the location trying to handle SIGINT is" ;
29
58
const stackTrace = new Error ( msg ) . stack || "" ;
30
59
logger . trace (
31
60
stackTrace . replace (
32
61
`Error: ${ msg } ` ,
33
62
`${ msg } (${ color . yellow (
34
- "note:"
35
- ) } this is not an error, just a stack-trace for debugging purposes):`
36
- )
63
+ "note:" ,
64
+ ) } this is not an error, just a stack-trace for debugging purposes):`,
65
+ ) ,
37
66
) ;
38
67
} else {
39
68
return originalProcessOn ( event , listener ) ;
@@ -52,23 +81,21 @@ process.on = (event: string, listener: any): any => {
52
81
const err : IErrors = injector . resolve ( "$errors" ) ;
53
82
err . printCallStack = config . DEBUG ;
54
83
55
- const $initializeService = injector . resolve < IInitializeService > (
56
- "initializeService"
57
- ) ;
84
+ const $initializeService =
85
+ injector . resolve < IInitializeService > ( "initializeService" ) ;
58
86
await $initializeService . initialize ( ) ;
59
87
60
88
const extensibilityService : IExtensibilityService = injector . resolve (
61
- "extensibilityService"
89
+ "extensibilityService" ,
62
90
) ;
63
91
try {
64
92
await settlePromises < IExtensionData > ( extensibilityService . loadExtensions ( ) ) ;
65
93
} catch ( err ) {
66
94
logger . trace ( "Unable to load extensions. Error is: " , err ) ;
67
95
}
68
96
69
- const commandDispatcher : ICommandDispatcher = injector . resolve (
70
- "commandDispatcher"
71
- ) ;
97
+ const commandDispatcher : ICommandDispatcher =
98
+ injector . resolve ( "commandDispatcher" ) ;
72
99
73
100
// unused...
74
101
// const messages: IMessagesService = injector.resolve("$messagesService");
0 commit comments