Check if process exists

This commit is contained in:
Matt Bierner 2021-07-19 14:14:25 -07:00
parent 03a2bf8dd7
commit 475370b7c9
No known key found for this signature in database
GPG key ID: 099C331567E11888

View file

@ -206,7 +206,7 @@ class Preview extends Disposable {
private async getWebviewContents(): Promise<string> {
const version = Date.now().toString();
const settings = {
isMac: process.platform === 'darwin',
isMac: isMac(),
src: await this.getResourcePath(this.webviewEditor, this.resource, version),
};
@ -262,6 +262,13 @@ class Preview extends Disposable {
}
}
function isMac(): boolean {
if (typeof process === 'undefined') {
return false;
}
return process.platform === 'darwin';
}
function escapeAttribute(value: string | vscode.Uri): string {
return value.toString().replace(/"/g, '&quot;');
}