@@ -6,13 +6,13 @@ import path = require("path");
6
6
import os = require( "os" ) ;
7
7
let options : any = require ( "../options" ) ;
8
8
import Future = require( "fibers/future" ) ;
9
+ import hostInfo = require( "../host-info" ) ;
9
10
10
- export class CancellationService implements ICancellationService {
11
+ class CancellationService implements ICancellationService {
11
12
private watches : IDictionary < IWatcherInstance > = { } ;
12
13
13
14
constructor ( private $fs : IFileSystem ,
14
- private $logger : ILogger ,
15
- private $errors : IErrors ) {
15
+ private $logger : ILogger ) {
16
16
this . $fs . createDirectory ( CancellationService . killSwitchDir ) . wait ( ) ;
17
17
this . $fs . chmod ( CancellationService . killSwitchDir , "0777" ) . wait ( ) ;
18
18
}
@@ -55,9 +55,7 @@ export class CancellationService implements ICancellationService {
55
55
}
56
56
57
57
public dispose ( ) : void {
58
- Object . keys ( this . watches ) . forEach ( ( name ) => {
59
- this . end ( name ) ;
60
- } )
58
+ _ ( this . watches ) . keys ( ) . each ( name => this . end ( name ) ) . values ( ) ;
61
59
}
62
60
63
61
private static get killSwitchDir ( ) : string {
@@ -68,4 +66,21 @@ export class CancellationService implements ICancellationService {
68
66
return path . join ( CancellationService . killSwitchDir , name ) ;
69
67
}
70
68
}
71
- $injector . register ( "cancellation" , CancellationService ) ;
69
+
70
+ class CancellationServiceDummy implements ICancellationService {
71
+ dispose ( ) :void {
72
+ }
73
+
74
+ begin ( name :string ) :IFuture < void > {
75
+ return Future . fromResult ( ) ;
76
+ }
77
+
78
+ end ( name :string ) :void {
79
+ }
80
+ }
81
+
82
+ if ( hostInfo . isWindows ( ) ) {
83
+ $injector . register ( "cancellation" , CancellationService ) ;
84
+ } else {
85
+ $injector . register ( "cancellation" , CancellationServiceDummy ) ;
86
+ }
0 commit comments