File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -108,8 +108,14 @@ export class XCodeSimctlSimulator extends IPhoneSimulatorNameGetter implements I
108
108
}
109
109
110
110
private getPid ( deviceId : string , bundleExecutable : string ) : string {
111
- return childProcess . execSync ( `ps -ef | grep ${ bundleExecutable } | grep ${ deviceId } | grep -v grep | awk '{print $2}'` , { skipError : true } ) . toString ( ) . trim ( ) ;
112
- }
111
+ // Sample output of the command ps -ef | grep app3grep | grep /86DCBE59-7ED0-447D-832B-A397322BD712/
112
+ // 1203284766 59345 51524 0 7:11pm ?? 0:01.32 /Users/username/Library/Developer/CoreSimulator/Devices/86DCBE59-7ED0-447D-832B-A397322BD712/data/Containers/Bundle/Application/4E79A7E8-9AAB-40B9-89EF-C8D7B91B819E/app3grep.app/app3grep
113
+ // 1203284766 59486 59396 0 7:15pm ?? 0:00.01 /bin/sh -c ps -ef | grep app3grep | grep /86DCBE59-7ED0-447D-832B-A397322BD712/
114
+ // The process, that is execed by Node.js is also returned, so we need to exclude it from the result.
115
+ // To achieve this, remove the command we've executed from the ps result.
116
+ const grepAppProcessCommand = `ps -ef | grep ${ bundleExecutable } | grep \/${ deviceId } \/` ;
117
+ return childProcess . execSync ( `${ grepAppProcessCommand } | grep -v "${ grepAppProcessCommand } " | awk '{print $2}'` , { skipError : true } ) . toString ( ) . trim ( ) ;
118
+ }
113
119
114
120
public async getDeviceLogProcess ( deviceId : string , predicate ?: string ) : Promise < child_process . ChildProcess > {
115
121
const device = await this . getDeviceFromIdentifier ( deviceId ) ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " ios-sim-portable" ,
3
- "version" : " 4.0.6 " ,
3
+ "version" : " 4.0.7 " ,
4
4
"description" : " " ,
5
5
"main" : " ./lib/ios-sim.js" ,
6
6
"scripts" : {
You can’t perform that action at this time.
0 commit comments