try to fix linux prompt

This commit is contained in:
gengjiawen 2017-06-25 16:49:38 +08:00 committed by Philip Chimento
parent fb4a54c9fb
commit 7bc697ea72
3 changed files with 11 additions and 1 deletions

View file

@ -13,6 +13,9 @@ declare const __DARWIN__: boolean
/** Is the app being built to run on Win32? */
declare const __WIN32__: boolean
/** Is the app being built to run on Linux? */
declare const __LINUX__: boolean
/**
* The commit id of the repository HEAD at build time.
* Represented as a 40 character SHA-1 hexadecimal digest string.

View file

@ -15,6 +15,11 @@ export function openShell(fullPath: string, shell?: string) {
return spawn('START', [shell || 'cmd'], { shell: true, cwd: fullPath })
}
if (__LINUX__) {
const commandArgs = ['--working-directory', fullPath]
return spawn('gnome-terminal', commandArgs, { shell: true })
}
return fatalError('Unsupported OS')
}
@ -22,7 +27,8 @@ export function isGitOnPath(): Promise<boolean> {
// Modern versions of macOS ship with a Git shim that guides you through
// the process of setting everything up. We trust this is available, so
// don't worry about looking for it here.
if (__DARWIN__) {
// I decide linux user have git too :)
if (__DARWIN__ || __LINUX__) {
return Promise.resolve(true)
}

View file

@ -46,6 +46,7 @@ const replacements = {
),
__DARWIN__: process.platform === 'darwin',
__WIN32__: process.platform === 'win32',
__LINUX__: process.platform === 'linux',
__DEV__: environment === 'development',
__RELEASE_ENV__: JSON.stringify(environment),
__SHA__: JSON.stringify(revParse(path.resolve(__dirname, '../.git'), 'HEAD')),