File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ Fix issue with survey not opening in a browser for Windows users.
Original file line number Diff line number Diff line change 11// Copyright (c) Microsoft Corporation. All rights reserved.
22// Licensed under the MIT License.
33
4- import * as child_process from 'child_process' ;
4+ 'use strict' ;
5+
6+ // tslint:disable:no-require-imports no-var-requires
7+ const opn = require ( 'opn' ) ;
8+
59import { injectable } from 'inversify' ;
6- import * as os from 'os' ;
710import { IBrowserService } from '../types' ;
811
912export function launch ( url : string ) {
10- let openCommand : string | undefined ;
11- if ( os . platform ( ) === 'win32' ) {
12- openCommand = 'explorer' ;
13- } else if ( os . platform ( ) === 'darwin' ) {
14- openCommand = '/usr/bin/open' ;
15- } else {
16- openCommand = '/usr/bin/xdg-open' ;
17- }
18- if ( ! openCommand ) {
19- console . error ( `Unable to determine platform to launch the browser in the Python extension on platform '${ os . platform ( ) } '.` ) ;
20- console . error ( `Link is: ${ url } ` ) ;
21- }
22- child_process . spawn ( openCommand , [ url ] ) ;
13+ opn ( url ) ;
2314}
2415
2516@injectable ( )
2617export class BrowserService implements IBrowserService {
27- public launch ( url : string ) : void {
18+ public launch ( url : string ) : void {
2819 launch ( url ) ;
2920 }
3021}
You can’t perform that action at this time.
0 commit comments