提交 5d9853d6 编写于 作者: J Joao Moreno

call CreateMutex whenever Code is running

上级 b6c33d1f
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare module 'windows-mutex' {
export class Mutex {
constructor(name: string);
isActive(): boolean;
release(): void;
}
}
\ No newline at end of file
......@@ -9,7 +9,6 @@ import app = require('app');
import fs = require('fs');
import dialog = require('dialog');
import shell = require('shell');
import nls = require('vs/nls');
import {assign} from 'vs/base/common/objects';
import platform = require('vs/base/common/platform');
......@@ -233,6 +232,15 @@ function setupIPC(): TPromise<Server> {
return setup(true);
}
function setupMutex() {
try {
var Mutex = (<any> require.__$__nodeRequire('windows-mutex')).Mutex;
new Mutex('vscode');
} catch (e) {
// noop
}
}
// On some platforms we need to manually read from the global environment variables
// and assign them to the process environment (e.g. when doubleclick app on Mac)
getUserEnvironment()
......@@ -241,6 +249,7 @@ getUserEnvironment()
return timebomb()
.then(setupIPC)
.then(ipcServer => { setupMutex(); return ipcServer; })
.then(ipcServer => main(ipcServer, userEnv));
})
.done(null, quit);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册