parent
4a92332728
commit
66b231db13
1 changed files with 7 additions and 6 deletions
|
@ -59,7 +59,6 @@ import { cwd } from 'vs/base/common/process';
|
|||
import { IProtocolMainService } from 'vs/platform/protocol/electron-main/protocol';
|
||||
import { ProtocolMainService } from 'vs/platform/protocol/electron-main/protocolMainService';
|
||||
import { Promises } from 'vs/base/common/async';
|
||||
import { toDisposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
/**
|
||||
* The main VS Code entry point.
|
||||
|
@ -340,8 +339,7 @@ class CodeMain {
|
|||
throw new ExpectedError('Sent env to running instance. Terminating...');
|
||||
}
|
||||
|
||||
const lockFile = await this.createLockfile(environmentMainService);
|
||||
once(lifecycleMainService.onWillShutdown)(() => lockFile.dispose());
|
||||
this.createLockfile(logService, lifecycleMainService, environmentMainService);
|
||||
|
||||
// Print --status usage info
|
||||
if (environmentMainService.args.status) {
|
||||
|
@ -423,10 +421,13 @@ class CodeMain {
|
|||
lifecycleMainService.kill(exitCode);
|
||||
}
|
||||
|
||||
private async createLockfile(env: IEnvironmentMainService) {
|
||||
await FSPromises.writeFile(env.mainLockfile, String(process.pid));
|
||||
private async createLockfile(logService: ILogService, lifecycle: ILifecycleMainService, env: IEnvironmentMainService) {
|
||||
FSPromises.writeFile(env.mainLockfile, String(process.pid)).catch(err => {
|
||||
logService.warn(`Error writing main lockfile: ${err.stack}`);
|
||||
});
|
||||
|
||||
return toDisposable(() => {
|
||||
|
||||
once(lifecycle.onWillShutdown)(() => {
|
||||
try {
|
||||
unlinkSync(env.mainLockfile);
|
||||
} catch {
|
||||
|
|
Loading…
Reference in a new issue