Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Commit d1230fa

Browse files
committed
Merge pull request #332 from telerik/remove-cancellation
Use Cancellation service only on Windows
2 parents 24f02d3 + 5bf1364 commit d1230fa

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

commands/preuninstall.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ export class PreUninstallCommand implements ICommand {
1010

1111
constructor(private $fs: IFileSystem,
1212
private $childProcess: IChildProcess,
13-
private $logger: ILogger) { }
13+
private $logger: ILogger,
14+
private $cancellationService: ICancellationService) { }
1415
public disableAnalytics = true;
1516

1617
public allowedParameters: ICommandParameter[] = [];

services/cancellation.ts

+22-7
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import path = require("path");
66
import os = require("os");
77
let options: any = require("../options");
88
import Future = require("fibers/future");
9+
import hostInfo = require("../host-info");
910

10-
export class CancellationService implements ICancellationService {
11+
class CancellationService implements ICancellationService {
1112
private watches: IDictionary<IWatcherInstance> = {};
1213

1314
constructor(private $fs: IFileSystem,
14-
private $logger: ILogger,
15-
private $errors: IErrors) {
15+
private $logger: ILogger) {
1616
this.$fs.createDirectory(CancellationService.killSwitchDir).wait();
1717
this.$fs.chmod(CancellationService.killSwitchDir, "0777").wait();
1818
}
@@ -55,9 +55,7 @@ export class CancellationService implements ICancellationService {
5555
}
5656

5757
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();
6159
}
6260

6361
private static get killSwitchDir(): string {
@@ -68,4 +66,21 @@ export class CancellationService implements ICancellationService {
6866
return path.join(CancellationService.killSwitchDir, name);
6967
}
7068
}
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

Comments
 (0)