remove TPromise from ipc.net

This commit is contained in:
Joao Moreno
2018-09-10 16:50:45 +02:00
parent 72484fd03a
commit c403c7609f
3 changed files with 23 additions and 24 deletions

View File

@@ -145,11 +145,11 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I
});
}
function setupIPC(hook: string): TPromise<Server> {
function setup(retry: boolean): TPromise<Server> {
function setupIPC(hook: string): Thenable<Server> {
function setup(retry: boolean): Thenable<Server> {
return serve(hook).then(null, err => {
if (!retry || platform.isWindows || err.code !== 'EADDRINUSE') {
return TPromise.wrapError(err);
return Promise.reject(err);
}
// should retry, not windows and eaddrinuse
@@ -158,7 +158,7 @@ function setupIPC(hook: string): TPromise<Server> {
client => {
// we could connect to a running instance. this is not good, abort
client.dispose();
return TPromise.wrapError(new Error('There is an instance already running.'));
return Promise.reject(new Error('There is an instance already running.'));
},
err => {
// it happens on Linux and OS X that the pipe is left behind
@@ -167,7 +167,7 @@ function setupIPC(hook: string): TPromise<Server> {
try {
fs.unlinkSync(hook);
} catch (e) {
return TPromise.wrapError(new Error('Error deleting the shared ipc hook.'));
return Promise.reject(new Error('Error deleting the shared ipc hook.'));
}
return setup(false);