File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 11import find from 'find-process' ;
22import { isObject } from 'lodash' ;
3+ import path from 'path' ;
34import { logger } from './logging' ;
45
56/* eslint-disable consistent-return */
@@ -39,8 +40,12 @@ export const getProcess = async (
3940 // Return first matching process if names match
4041 const previousProcess : Process = matchingProcesses [ 0 ] ;
4142
42- if ( isObject ( previousProcess ) && previousProcess . name === processName ) {
43- return previousProcess ;
43+ if ( isObject ( previousProcess ) ) {
44+ const binPathSegments = previousProcess . bin . split ( path . sep ) ;
45+ const exeName = binPathSegments . length > 0 ? binPathSegments [ binPathSegments . length - 1 ] : previousProcess . bin ;
46+ if ( exeName === processName || previousProcess . name === processName ) {
47+ return previousProcess ;
48+ }
4449 }
4550 } catch ( error ) {
4651 logger . error ( 'getProcess error' , {
You can’t perform that action at this time.
0 commit comments