forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbrowser.ts
More file actions
21 lines (19 loc) · 720 Bytes
/
browser.ts
File metadata and controls
21 lines (19 loc) · 720 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import * as child_process from 'child_process';
import * as os from 'os';
export function launch(url: string) {
let openCommand: string | undefined;
if (os.platform() === 'win32') {
openCommand = 'explorer';
} else if (os.platform() === 'darwin') {
openCommand = '/usr/bin/open';
} else {
openCommand = '/usr/bin/xdg-open';
}
if (!openCommand) {
console.error(`Unable to determine platform to launch the browser in the Python extension on platform '${os.platform()}'.`);
console.error(`Link is: ${url}`);
}
child_process.spawn(openCommand, [url]);
}