File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3434 "rollup-plugin-typescript" : " 0.7.7" ,
3535 "rollup-watch" : " 2.5.0" ,
3636 "tslint" : " 3.14.0" ,
37- "typescript" : " 2.0.0 " ,
37+ "typescript" : " ^2.1.4 " ,
3838 "typings" : " 2.0.0"
3939 },
4040 "peerDependencies" : {
Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ import { RequestHandler } from 'express-serve-static-core';
44import Logger from './utils/logger' ;
55import Configuration from './configuration/configuration' ;
66import { spawn } from 'child_process' ;
7+ import { exec } from 'child_process' ;
8+ import * as path from "path" ;
79import * as connectLiveReload from 'connect-livereload' ;
810import * as tinyLr from 'tiny-lr' ;
911import ActionsEmitter , { } from './utils/actions-emitter' ;
@@ -73,7 +75,28 @@ export default class ServerStarter {
7375
7476 private openBrowser ( serverUrl : string ) {
7577 if ( ! this . isQuiet ) {
76- spawn ( 'explorer' , [ serverUrl ] ) ;
78+ let opener = '' ;
79+ switch ( process . platform ) {
80+ case 'darwin' :
81+ opener = 'open' ;
82+ break ;
83+ case 'win32' :
84+ opener = 'start ""' ;
85+ break ;
86+ default :
87+ opener = path . join ( __dirname , '../vendor/xdg-open' ) ;
88+ break ;
89+ }
90+
91+ if ( process . env . SUDO_USER ) {
92+ opener = `sudo -u ${ process . env . SUDO_USER } ${ opener } ` ;
93+ }
94+ try {
95+ exec ( `opener "${ serverUrl } "` ) ;
96+ } catch ( error ) {
97+ Logger . error ( "Error with openBrowser." , error ) ;
98+ Logger . info ( "Please create new issue here: https://github.com/quatrocode/simplr-gulp/issues" ) ;
99+ }
77100 }
78101 }
79102
You can’t perform that action at this time.
0 commit comments