@@ -3,6 +3,35 @@ require("./bootstrap");
33import * as shelljs from "shelljs" ;
44shelljs . config . silent = true ;
55shelljs . 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+
635import { installUncaughtExceptionListener } from "./common/errors" ;
736import { settlePromises } from "./common/helpers" ;
837import { injector } from "./common/yok" ;
@@ -14,7 +43,7 @@ import {
1443import { IInitializeService } from "./definitions/initialize-service" ;
1544import { color } from "./color" ;
1645installUncaughtExceptionListener (
17- process . exit . bind ( process , ErrorCodes . UNCAUGHT )
46+ process . exit . bind ( process , ErrorCodes . UNCAUGHT ) ,
1847) ;
1948
2049const logger : ILogger = injector . resolve ( "logger" ) ;
@@ -23,17 +52,17 @@ export const originalProcessOn = process.on.bind(process);
2352process . on = ( event : string , listener : any ) : any => {
2453 if ( event === "SIGINT" ) {
2554 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.` ,
2756 ) ;
2857 const msg = "The stackTrace of the location trying to handle SIGINT is" ;
2958 const stackTrace = new Error ( msg ) . stack || "" ;
3059 logger . trace (
3160 stackTrace . replace (
3261 `Error: ${ msg } ` ,
3362 `${ 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+ ) ,
3766 ) ;
3867 } else {
3968 return originalProcessOn ( event , listener ) ;
@@ -52,23 +81,21 @@ process.on = (event: string, listener: any): any => {
5281 const err : IErrors = injector . resolve ( "$errors" ) ;
5382 err . printCallStack = config . DEBUG ;
5483
55- const $initializeService = injector . resolve < IInitializeService > (
56- "initializeService"
57- ) ;
84+ const $initializeService =
85+ injector . resolve < IInitializeService > ( "initializeService" ) ;
5886 await $initializeService . initialize ( ) ;
5987
6088 const extensibilityService : IExtensibilityService = injector . resolve (
61- "extensibilityService"
89+ "extensibilityService" ,
6290 ) ;
6391 try {
6492 await settlePromises < IExtensionData > ( extensibilityService . loadExtensions ( ) ) ;
6593 } catch ( err ) {
6694 logger . trace ( "Unable to load extensions. Error is: " , err ) ;
6795 }
6896
69- const commandDispatcher : ICommandDispatcher = injector . resolve (
70- "commandDispatcher"
71- ) ;
97+ const commandDispatcher : ICommandDispatcher =
98+ injector . resolve ( "commandDispatcher" ) ;
7299
73100 // unused...
74101 // const messages: IMessagesService = injector.resolve("$messagesService");
0 commit comments