appium-mac2-driver 3.4.3 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +4 -4
- package/build/lib/commands/app-management.d.ts +1 -1
- package/build/lib/commands/app-management.d.ts.map +1 -1
- package/build/lib/commands/app-management.js +4 -10
- package/build/lib/commands/app-management.js.map +1 -1
- package/build/lib/commands/applescript.d.ts +2 -2
- package/build/lib/commands/applescript.d.ts.map +1 -1
- package/build/lib/commands/applescript.js +11 -17
- package/build/lib/commands/applescript.js.map +1 -1
- package/build/lib/commands/audit.d.ts +1 -1
- package/build/lib/commands/audit.d.ts.map +1 -1
- package/build/lib/commands/audit.js +1 -4
- package/build/lib/commands/audit.js.map +1 -1
- package/build/lib/commands/bidi/constants.js +2 -5
- package/build/lib/commands/bidi/constants.js.map +1 -1
- package/build/lib/commands/bidi/models.d.ts +1 -1
- package/build/lib/commands/bidi/models.d.ts.map +1 -1
- package/build/lib/commands/bidi/models.js +3 -6
- package/build/lib/commands/bidi/models.js.map +1 -1
- package/build/lib/commands/bidi/types.js +1 -2
- package/build/lib/commands/clipboard.d.ts +1 -1
- package/build/lib/commands/clipboard.d.ts.map +1 -1
- package/build/lib/commands/clipboard.js +2 -6
- package/build/lib/commands/clipboard.js.map +1 -1
- package/build/lib/commands/execute.d.ts +1 -1
- package/build/lib/commands/execute.d.ts.map +1 -1
- package/build/lib/commands/execute.js +1 -4
- package/build/lib/commands/execute.js.map +1 -1
- package/build/lib/commands/find.d.ts +1 -1
- package/build/lib/commands/find.d.ts.map +1 -1
- package/build/lib/commands/find.js +3 -6
- package/build/lib/commands/find.js.map +1 -1
- package/build/lib/commands/gestures.d.ts +2 -2
- package/build/lib/commands/gestures.d.ts.map +1 -1
- package/build/lib/commands/gestures.js +23 -40
- package/build/lib/commands/gestures.js.map +1 -1
- package/build/lib/commands/helpers.d.ts +1 -1
- package/build/lib/commands/helpers.d.ts.map +1 -1
- package/build/lib/commands/helpers.js +6 -9
- package/build/lib/commands/helpers.js.map +1 -1
- package/build/lib/commands/native-record-screen.d.ts +1 -1
- package/build/lib/commands/native-record-screen.d.ts.map +1 -1
- package/build/lib/commands/native-record-screen.js +84 -63
- package/build/lib/commands/native-record-screen.js.map +1 -1
- package/build/lib/commands/navigation.d.ts +1 -1
- package/build/lib/commands/navigation.d.ts.map +1 -1
- package/build/lib/commands/navigation.js +1 -4
- package/build/lib/commands/navigation.js.map +1 -1
- package/build/lib/commands/record-screen.d.ts +2 -2
- package/build/lib/commands/record-screen.d.ts.map +1 -1
- package/build/lib/commands/record-screen.js +20 -28
- package/build/lib/commands/record-screen.js.map +1 -1
- package/build/lib/commands/screenshots.d.ts +2 -2
- package/build/lib/commands/screenshots.d.ts.map +1 -1
- package/build/lib/commands/screenshots.js +1 -4
- package/build/lib/commands/screenshots.js.map +1 -1
- package/build/lib/commands/source.d.ts +1 -1
- package/build/lib/commands/source.d.ts.map +1 -1
- package/build/lib/commands/source.js +1 -4
- package/build/lib/commands/source.js.map +1 -1
- package/build/lib/constraints.js +1 -3
- package/build/lib/constraints.js.map +1 -1
- package/build/lib/doctor/optional-checks.d.ts +21 -0
- package/build/lib/doctor/optional-checks.d.ts.map +1 -1
- package/build/lib/doctor/optional-checks.js +116 -20
- package/build/lib/doctor/optional-checks.js.map +1 -1
- package/build/lib/doctor/required-checks.js +16 -21
- package/build/lib/doctor/required-checks.js.map +1 -1
- package/build/lib/doctor/utils.js +4 -7
- package/build/lib/doctor/utils.js.map +1 -1
- package/build/lib/driver.d.ts +15 -15
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +31 -71
- package/build/lib/driver.js.map +1 -1
- package/build/lib/execute-method-map.js +1 -4
- package/build/lib/execute-method-map.js.map +1 -1
- package/build/lib/index.d.ts +1 -1
- package/build/lib/index.d.ts.map +1 -1
- package/build/lib/index.js +3 -6
- package/build/lib/index.js.map +1 -1
- package/build/lib/logger.js +3 -5
- package/build/lib/logger.js.map +1 -1
- package/build/lib/method-map.js +1 -4
- package/build/lib/method-map.js.map +1 -1
- package/build/lib/types.js +1 -2
- package/build/lib/utils.d.ts +7 -0
- package/build/lib/utils.d.ts.map +1 -1
- package/build/lib/utils.js +24 -22
- package/build/lib/utils.js.map +1 -1
- package/build/lib/wda-mac.d.ts +1 -1
- package/build/lib/wda-mac.d.ts.map +1 -1
- package/build/lib/wda-mac.js +43 -51
- package/build/lib/wda-mac.js.map +1 -1
- package/lib/commands/app-management.ts +1 -1
- package/lib/commands/applescript.ts +3 -3
- package/lib/commands/audit.ts +1 -1
- package/lib/commands/bidi/models.ts +2 -2
- package/lib/commands/clipboard.ts +1 -1
- package/lib/commands/execute.ts +1 -1
- package/lib/commands/find.ts +2 -2
- package/lib/commands/gestures.ts +4 -4
- package/lib/commands/helpers.ts +2 -2
- package/lib/commands/native-record-screen.ts +67 -35
- package/lib/commands/navigation.ts +1 -1
- package/lib/commands/record-screen.ts +4 -4
- package/lib/commands/screenshots.ts +2 -2
- package/lib/commands/source.ts +1 -1
- package/lib/doctor/optional-checks.ts +127 -2
- package/lib/doctor/required-checks.ts +1 -1
- package/lib/doctor/utils.ts +1 -1
- package/lib/driver.ts +18 -18
- package/lib/index.ts +1 -1
- package/lib/logger.ts +1 -1
- package/lib/utils.ts +20 -9
- package/lib/wda-mac.ts +3 -3
- package/npm-shrinkwrap.json +130 -590
- package/package.json +13 -12
|
@@ -1,22 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.macosSetValue = macosSetValue;
|
|
4
|
-
exports.macosClick = macosClick;
|
|
5
|
-
exports.macosScroll = macosScroll;
|
|
6
|
-
exports.macosSwipe = macosSwipe;
|
|
7
|
-
exports.macosRightClick = macosRightClick;
|
|
8
|
-
exports.macosHover = macosHover;
|
|
9
|
-
exports.macosDoubleClick = macosDoubleClick;
|
|
10
|
-
exports.macosClickAndDrag = macosClickAndDrag;
|
|
11
|
-
exports.macosClickAndDragAndHold = macosClickAndDragAndHold;
|
|
12
|
-
exports.macosKeys = macosKeys;
|
|
13
|
-
exports.macosTap = macosTap;
|
|
14
|
-
exports.macosDoubleTap = macosDoubleTap;
|
|
15
|
-
exports.macosPressAndHold = macosPressAndHold;
|
|
16
|
-
exports.macosPressAndDrag = macosPressAndDrag;
|
|
17
|
-
exports.macosPressAndDragAndHold = macosPressAndDragAndHold;
|
|
18
|
-
const support_1 = require("appium/support");
|
|
19
|
-
const driver_1 = require("appium/driver");
|
|
1
|
+
import { util } from 'appium/support.js';
|
|
2
|
+
import { errors } from 'appium/driver.js';
|
|
20
3
|
/**
|
|
21
4
|
* Set value to the given element.
|
|
22
5
|
* Note:
|
|
@@ -31,7 +14,7 @@ const driver_1 = require("appium/driver");
|
|
|
31
14
|
* https://developer.apple.com/documentation/xctest/xcuikeymodifierflags
|
|
32
15
|
* for more details.
|
|
33
16
|
*/
|
|
34
|
-
async function macosSetValue(elementId, value, text, keyModifierFlags) {
|
|
17
|
+
export async function macosSetValue(elementId, value, text, keyModifierFlags) {
|
|
35
18
|
return await this.wda.proxy.command(`/element/${elementId}/value`, 'POST', {
|
|
36
19
|
value,
|
|
37
20
|
text,
|
|
@@ -52,7 +35,7 @@ async function macosSetValue(elementId, value, text, keyModifierFlags) {
|
|
|
52
35
|
* https://developer.apple.com/documentation/xctest/xcuikeymodifierflags
|
|
53
36
|
* for more details
|
|
54
37
|
*/
|
|
55
|
-
async function macosClick(elementId, x, y, keyModifierFlags) {
|
|
38
|
+
export async function macosClick(elementId, x, y, keyModifierFlags) {
|
|
56
39
|
requireElementIdOrXY(elementId, x, y);
|
|
57
40
|
const url = elementId ? `/element/${elementId}/click` : '/wda/click';
|
|
58
41
|
return await this.wda.proxy.command(url, 'POST', {
|
|
@@ -77,7 +60,7 @@ async function macosClick(elementId, x, y, keyModifierFlags) {
|
|
|
77
60
|
* https://developer.apple.com/documentation/xctest/xcuikeymodifierflags
|
|
78
61
|
* for more details
|
|
79
62
|
*/
|
|
80
|
-
async function macosScroll(deltaX, deltaY, elementId, x, y, keyModifierFlags) {
|
|
63
|
+
export async function macosScroll(deltaX, deltaY, elementId, x, y, keyModifierFlags) {
|
|
81
64
|
requireElementIdOrXY(elementId, x, y);
|
|
82
65
|
const url = elementId ? `/wda/element/${elementId}/scroll` : '/wda/scroll';
|
|
83
66
|
return await this.wda.proxy.command(url, 'POST', {
|
|
@@ -108,7 +91,7 @@ async function macosScroll(deltaX, deltaY, elementId, x, y, keyModifierFlags) {
|
|
|
108
91
|
* https://developer.apple.com/documentation/xctest/xcuikeymodifierflags
|
|
109
92
|
* for more details
|
|
110
93
|
*/
|
|
111
|
-
async function macosSwipe(direction, elementId, x, y, velocity, keyModifierFlags) {
|
|
94
|
+
export async function macosSwipe(direction, elementId, x, y, velocity, keyModifierFlags) {
|
|
112
95
|
requireElementIdOrXY(elementId, x, y);
|
|
113
96
|
const url = elementId ? `/wda/element/${elementId}/swipe` : `/wda/swipe`;
|
|
114
97
|
return await this.wda.proxy.command(url, 'POST', {
|
|
@@ -133,7 +116,7 @@ async function macosSwipe(direction, elementId, x, y, velocity, keyModifierFlags
|
|
|
133
116
|
* https://developer.apple.com/documentation/xctest/xcuikeymodifierflags
|
|
134
117
|
* for more details
|
|
135
118
|
*/
|
|
136
|
-
async function macosRightClick(elementId, x, y, keyModifierFlags) {
|
|
119
|
+
export async function macosRightClick(elementId, x, y, keyModifierFlags) {
|
|
137
120
|
requireElementIdOrXY(elementId, x, y);
|
|
138
121
|
const url = elementId ? `/wda/element/${elementId}/rightClick` : '/wda/rightClick';
|
|
139
122
|
return await this.wda.proxy.command(url, 'POST', {
|
|
@@ -156,7 +139,7 @@ async function macosRightClick(elementId, x, y, keyModifierFlags) {
|
|
|
156
139
|
* https://developer.apple.com/documentation/xctest/xcuikeymodifierflags
|
|
157
140
|
* for more details
|
|
158
141
|
*/
|
|
159
|
-
async function macosHover(elementId, x, y, keyModifierFlags) {
|
|
142
|
+
export async function macosHover(elementId, x, y, keyModifierFlags) {
|
|
160
143
|
requireElementIdOrXY(elementId, x, y);
|
|
161
144
|
const url = elementId ? `/wda/element/${elementId}/hover` : '/wda/hover';
|
|
162
145
|
return await this.wda.proxy.command(url, 'POST', {
|
|
@@ -179,7 +162,7 @@ async function macosHover(elementId, x, y, keyModifierFlags) {
|
|
|
179
162
|
* https://developer.apple.com/documentation/xctest/xcuikeymodifierflags
|
|
180
163
|
* for more details
|
|
181
164
|
*/
|
|
182
|
-
async function macosDoubleClick(elementId, x, y, keyModifierFlags) {
|
|
165
|
+
export async function macosDoubleClick(elementId, x, y, keyModifierFlags) {
|
|
183
166
|
requireElementIdOrXY(elementId, x, y);
|
|
184
167
|
const url = elementId ? `/wda/element/${elementId}/doubleClick` : '/wda/doubleClick';
|
|
185
168
|
return await this.wda.proxy.command(url, 'POST', {
|
|
@@ -207,12 +190,12 @@ async function macosDoubleClick(elementId, x, y, keyModifierFlags) {
|
|
|
207
190
|
* https://developer.apple.com/documentation/xctest/xcuikeymodifierflags
|
|
208
191
|
* for more details
|
|
209
192
|
*/
|
|
210
|
-
async function macosClickAndDrag(duration, sourceElementId, destinationElementId, startX, startY, endX, endY, keyModifierFlags) {
|
|
193
|
+
export async function macosClickAndDrag(duration, sourceElementId, destinationElementId, startX, startY, endX, endY, keyModifierFlags) {
|
|
211
194
|
requireSourceDestWithElementsOrCoordinates(sourceElementId, destinationElementId, startX, startY, endX, endY);
|
|
212
195
|
const url = sourceElementId && destinationElementId
|
|
213
196
|
? `/wda/element/${sourceElementId}/clickAndDrag`
|
|
214
197
|
: '/wda/clickAndDrag';
|
|
215
|
-
const dest = destinationElementId &&
|
|
198
|
+
const dest = destinationElementId && util.wrapElement(destinationElementId);
|
|
216
199
|
return await this.wda.proxy.command(url, 'POST', {
|
|
217
200
|
startX,
|
|
218
201
|
startY,
|
|
@@ -247,12 +230,12 @@ async function macosClickAndDrag(duration, sourceElementId, destinationElementId
|
|
|
247
230
|
* https://developer.apple.com/documentation/xctest/xcuikeymodifierflags
|
|
248
231
|
* for more details
|
|
249
232
|
*/
|
|
250
|
-
async function macosClickAndDragAndHold(duration, holdDuration, sourceElementId, destinationElementId, startX, startY, endX, endY, velocity, keyModifierFlags) {
|
|
233
|
+
export async function macosClickAndDragAndHold(duration, holdDuration, sourceElementId, destinationElementId, startX, startY, endX, endY, velocity, keyModifierFlags) {
|
|
251
234
|
requireSourceDestWithElementsOrCoordinates(sourceElementId, destinationElementId, startX, startY, endX, endY);
|
|
252
235
|
const url = sourceElementId && destinationElementId
|
|
253
236
|
? `/wda/element/${sourceElementId}/clickAndDragAndHold`
|
|
254
237
|
: '/wda/clickAndDragAndHold';
|
|
255
|
-
const dest = destinationElementId &&
|
|
238
|
+
const dest = destinationElementId && util.wrapElement(destinationElementId);
|
|
256
239
|
return await this.wda.proxy.command(url, 'POST', {
|
|
257
240
|
startX,
|
|
258
241
|
startY,
|
|
@@ -277,7 +260,7 @@ async function macosClickAndDragAndHold(duration, holdDuration, sourceElementId,
|
|
|
277
260
|
* If unset then keys are sent to the current application
|
|
278
261
|
* under test.
|
|
279
262
|
*/
|
|
280
|
-
async function macosKeys(keys, elementId) {
|
|
263
|
+
export async function macosKeys(keys, elementId) {
|
|
281
264
|
const url = elementId ? `/wda/element/${elementId}/keys` : '/wda/keys';
|
|
282
265
|
return await this.wda.proxy.command(url, 'POST', { keys });
|
|
283
266
|
}
|
|
@@ -295,7 +278,7 @@ async function macosKeys(keys, elementId) {
|
|
|
295
278
|
* https://developer.apple.com/documentation/xctest/xcuikeymodifierflags
|
|
296
279
|
* for more details
|
|
297
280
|
*/
|
|
298
|
-
async function macosTap(elementId, x, y, keyModifierFlags) {
|
|
281
|
+
export async function macosTap(elementId, x, y, keyModifierFlags) {
|
|
299
282
|
requireElementIdOrXY(elementId, x, y);
|
|
300
283
|
const url = elementId ? `/wda/element/${elementId}/tap` : '/wda/tap';
|
|
301
284
|
return await this.wda.proxy.command(url, 'POST', {
|
|
@@ -318,7 +301,7 @@ async function macosTap(elementId, x, y, keyModifierFlags) {
|
|
|
318
301
|
* https://developer.apple.com/documentation/xctest/xcuikeymodifierflags
|
|
319
302
|
* for more details
|
|
320
303
|
*/
|
|
321
|
-
async function macosDoubleTap(elementId, x, y, keyModifierFlags) {
|
|
304
|
+
export async function macosDoubleTap(elementId, x, y, keyModifierFlags) {
|
|
322
305
|
requireElementIdOrXY(elementId, x, y);
|
|
323
306
|
const url = elementId ? `/wda/element/${elementId}/doubleTap` : '/wda/doubleTap';
|
|
324
307
|
return await this.wda.proxy.command(url, 'POST', {
|
|
@@ -342,7 +325,7 @@ async function macosDoubleTap(elementId, x, y, keyModifierFlags) {
|
|
|
342
325
|
* https://developer.apple.com/documentation/xctest/xcuikeymodifierflags
|
|
343
326
|
* for more details
|
|
344
327
|
*/
|
|
345
|
-
async function macosPressAndHold(duration, elementId, x, y, keyModifierFlags) {
|
|
328
|
+
export async function macosPressAndHold(duration, elementId, x, y, keyModifierFlags) {
|
|
346
329
|
const url = elementId ? `/wda/element/${elementId}/press` : '/wda/press';
|
|
347
330
|
return await this.wda.proxy.command(url, 'POST', {
|
|
348
331
|
x,
|
|
@@ -370,7 +353,7 @@ async function macosPressAndHold(duration, elementId, x, y, keyModifierFlags) {
|
|
|
370
353
|
* https://developer.apple.com/documentation/xctest/xcuikeymodifierflags
|
|
371
354
|
* for more details
|
|
372
355
|
*/
|
|
373
|
-
async function macosPressAndDrag(duration, sourceElementId, destinationElementId, startX, startY, endX, endY, keyModifierFlags) {
|
|
356
|
+
export async function macosPressAndDrag(duration, sourceElementId, destinationElementId, startX, startY, endX, endY, keyModifierFlags) {
|
|
374
357
|
// requireSourceDestWithElementsOrCoordinates(
|
|
375
358
|
// sourceElementId, destinationElementId,
|
|
376
359
|
// startX, startY, endX, endY,
|
|
@@ -378,7 +361,7 @@ async function macosPressAndDrag(duration, sourceElementId, destinationElementId
|
|
|
378
361
|
const url = sourceElementId && destinationElementId
|
|
379
362
|
? `/wda/element/${sourceElementId}/pressAndDrag`
|
|
380
363
|
: '/wda/pressAndDrag';
|
|
381
|
-
const dest = destinationElementId &&
|
|
364
|
+
const dest = destinationElementId && util.wrapElement(destinationElementId);
|
|
382
365
|
return await this.wda.proxy.command(url, 'POST', {
|
|
383
366
|
startX,
|
|
384
367
|
startY,
|
|
@@ -413,12 +396,12 @@ async function macosPressAndDrag(duration, sourceElementId, destinationElementId
|
|
|
413
396
|
* https://developer.apple.com/documentation/xctest/xcuikeymodifierflags
|
|
414
397
|
* for more details
|
|
415
398
|
*/
|
|
416
|
-
async function macosPressAndDragAndHold(duration, holdDuration, sourceElementId, destinationElementId, startX, startY, endX, endY, velocity, keyModifierFlags) {
|
|
399
|
+
export async function macosPressAndDragAndHold(duration, holdDuration, sourceElementId, destinationElementId, startX, startY, endX, endY, velocity, keyModifierFlags) {
|
|
417
400
|
requireSourceDestWithElementsOrCoordinates(sourceElementId, destinationElementId, startX, startY, endX, endY);
|
|
418
401
|
const url = sourceElementId && destinationElementId
|
|
419
402
|
? `/wda/element/${sourceElementId}/pressAndDragAndHold`
|
|
420
403
|
: '/wda/pressAndDragAndHold';
|
|
421
|
-
const dest = destinationElementId &&
|
|
404
|
+
const dest = destinationElementId && util.wrapElement(destinationElementId);
|
|
422
405
|
return await this.wda.proxy.command(url, 'POST', {
|
|
423
406
|
startX,
|
|
424
407
|
startY,
|
|
@@ -439,7 +422,7 @@ async function macosPressAndDragAndHold(duration, holdDuration, sourceElementId,
|
|
|
439
422
|
*/
|
|
440
423
|
function requireElementIdOrXY(elementId, x, y) {
|
|
441
424
|
if (typeof elementId !== 'string' && !(typeof x === 'number' && typeof y === 'number')) {
|
|
442
|
-
throw new
|
|
425
|
+
throw new errors.InvalidArgumentError(`'elementId' or 'x' and 'y' is required.`);
|
|
443
426
|
}
|
|
444
427
|
}
|
|
445
428
|
/**
|
|
@@ -458,7 +441,7 @@ function requireSourceDestWithElementsOrCoordinates(sourceElementId, destination
|
|
|
458
441
|
typeof startY === 'number' &&
|
|
459
442
|
typeof endX === 'number' &&
|
|
460
443
|
typeof endY === 'number')) {
|
|
461
|
-
throw new
|
|
444
|
+
throw new errors.InvalidArgumentError(`'sourceElementId' and 'destinationElementId' ` +
|
|
462
445
|
`or 'startX', 'startY', 'endX' and 'endY' are required.`);
|
|
463
446
|
}
|
|
464
447
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gestures.js","sourceRoot":"","sources":["../../../lib/commands/gestures.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gestures.js","sourceRoot":"","sources":["../../../lib/commands/gestures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAC;AAIxC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAEjC,SAAiB,EACjB,KAAW,EACX,IAAa,EACb,gBAAyB;IAEzB,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,SAAS,QAAQ,EAAE,MAAM,EAAE;QACzE,KAAK;QACL,IAAI;QACJ,gBAAgB;KACjB,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAE9B,SAAkB,EAClB,CAAU,EACV,CAAU,EACV,gBAAyB;IAEzB,oBAAoB,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACtC,MAAM,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,YAAY,SAAS,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC;IACrE,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE;QAC/C,CAAC;QACD,CAAC;QACD,gBAAgB;KACjB,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UA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":[],"mappings":"AACA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../lib/commands/helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAEhD;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GAAG,IAAI,EACzB,aAAa,GAAE,YAAiB,GAC/B,OAAO,CAAC,MAAM,CAAC,CAqBjB"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uploadRecordedMedia = uploadRecordedMedia;
|
|
4
|
-
const support_1 = require("appium/support");
|
|
1
|
+
import { util, fs, net } from 'appium/support.js';
|
|
5
2
|
/**
|
|
6
3
|
* Uploads the given local file to the specified remote path or returns
|
|
7
4
|
* it as a base64 string if no remote path is provided.
|
|
@@ -11,11 +8,11 @@ const support_1 = require("appium/support");
|
|
|
11
8
|
* @param uploadOptions Additional options for the upload, such as authentication and headers.
|
|
12
9
|
* @returns A promise that resolves to a base64 string if no remote path is provided, or an empty string if the file is uploaded.
|
|
13
10
|
*/
|
|
14
|
-
async function uploadRecordedMedia(localFile, remotePath, uploadOptions = {}) {
|
|
11
|
+
export async function uploadRecordedMedia(localFile, remotePath, uploadOptions = {}) {
|
|
15
12
|
if (remotePath == null || remotePath.length === 0) {
|
|
16
|
-
const { size } = await
|
|
17
|
-
this.log.debug(`The size of the resulting screen recording is ${
|
|
18
|
-
return (await
|
|
13
|
+
const { size } = await fs.stat(localFile);
|
|
14
|
+
this.log.debug(`The size of the resulting screen recording is ${util.toReadableSizeString(size)}`);
|
|
15
|
+
return (await util.toInMemoryBase64(localFile)).toString();
|
|
19
16
|
}
|
|
20
17
|
const { user, pass, method, headers, fileFieldName, formFields } = uploadOptions;
|
|
21
18
|
const options = {
|
|
@@ -27,7 +24,7 @@ async function uploadRecordedMedia(localFile, remotePath, uploadOptions = {}) {
|
|
|
27
24
|
if (user && pass) {
|
|
28
25
|
options.auth = { user, pass };
|
|
29
26
|
}
|
|
30
|
-
await
|
|
27
|
+
await net.uploadFile(localFile, remotePath, options);
|
|
31
28
|
return '';
|
|
32
29
|
}
|
|
33
30
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../lib/commands/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../lib/commands/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,EAAE,EAAE,GAAG,EAAC,MAAM,mBAAmB,CAAC;AAIhD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAEvC,SAAiB,EACjB,UAAyB,EACzB,gBAA8B,EAAE;IAEhC,IAAI,UAAU,IAAI,IAAI,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClD,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxC,IAAI,CAAC,GAAG,CAAC,KAAK,CACZ,iDAAiD,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CACnF,CAAC;QACF,OAAO,CAAC,MAAM,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC7D,CAAC;IAED,MAAM,EAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAC,GAAG,aAAa,CAAC;IAC/E,MAAM,OAAO,GAAiB;QAC5B,MAAM,EAAE,MAAM,IAAI,KAAK;QACvB,OAAO;QACP,aAAa;QACb,UAAU;KACX,CAAC;IACF,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;QACjB,OAAO,CAAC,IAAI,GAAG,EAAC,IAAI,EAAE,IAAI,EAAC,CAAC;IAC9B,CAAC;IACD,MAAM,GAAG,CAAC,UAAU,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IACrD,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-record-screen.d.ts","sourceRoot":"","sources":["../../../lib/commands/native-record-screen.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"native-record-screen.d.ts","sourceRoot":"","sources":["../../../lib/commands/native-record-screen.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AAE7C,OAAO,KAAK,EAAC,YAAY,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,YAAY,MAAM,aAAa,CAAC;AAqB5C,UAAU,eAAe;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,WAAW;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,qBAAa,4BAA4B;IACvC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAe;IACpC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA6B;IAIzD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAwC;IAKjE,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAc;IACnD,OAAO,CAAC,WAAW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,MAAM,CAAC,CA+DjB;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAE5F"}
|
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports.macosListDisplays = macosListDisplays;
|
|
11
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
12
|
-
const support_1 = require("appium/support");
|
|
13
|
-
const helpers_1 = require("./helpers");
|
|
14
|
-
const asyncbox_1 = require("asyncbox");
|
|
15
|
-
const teen_process_1 = require("teen_process");
|
|
16
|
-
const constants_1 = require("./bidi/constants");
|
|
17
|
-
const models_1 = require("./bidi/models");
|
|
18
|
-
const utils_1 = require("../utils");
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { fs, util } from 'appium/support.js';
|
|
3
|
+
import { uploadRecordedMedia } from './helpers.js';
|
|
4
|
+
import { TimeoutError, sleep, waitForCondition, withTimeout } from 'asyncbox';
|
|
5
|
+
import { exec } from 'teen_process';
|
|
6
|
+
import { BIDI_EVENT_NAME } from './bidi/constants.js';
|
|
7
|
+
import { toNativeVideoChunkAddedEvent } from './bidi/models.js';
|
|
8
|
+
import { isPlainObject } from '../utils.js';
|
|
9
|
+
import os from 'node:os';
|
|
19
10
|
const RECORDING_STARTUP_TIMEOUT_MS = 5000;
|
|
20
11
|
const BUFFER_SIZE = 0xffff;
|
|
21
12
|
const MONITORING_INTERVAL_DURATION_MS = 1000;
|
|
22
13
|
const MAX_MONITORING_DURATION_MS = 24 * 60 * 60 * 1000; // 1 day
|
|
23
14
|
const STOP_WAIT_TIMEOUT_MS = 5000;
|
|
24
|
-
|
|
15
|
+
/**
|
|
16
|
+
* XCTest daemon stores native screen recording attachments under `Data/Attachments` (legacy) or
|
|
17
|
+
* `Data/tmp/Attachments` (Xcode 26.5+). Brace `{,tmp/}` matches both in a single glob.
|
|
18
|
+
*/
|
|
19
|
+
const DAEMON_NATIVE_RECORDING_ATTACHMENT_GLOB = '*/Data/{,tmp/}Attachments/*';
|
|
20
|
+
export class NativeVideoChunksBroadcaster {
|
|
25
21
|
_ee;
|
|
26
22
|
_log;
|
|
27
23
|
_publishers;
|
|
@@ -111,21 +107,26 @@ class NativeVideoChunksBroadcaster {
|
|
|
111
107
|
async _createPublisher(uuid) {
|
|
112
108
|
let fullPath = '';
|
|
113
109
|
try {
|
|
114
|
-
await
|
|
115
|
-
const paths = await listAttachments();
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
110
|
+
await waitForCondition(async () => {
|
|
111
|
+
const { hasAccess, paths } = await listAttachments();
|
|
112
|
+
if (!hasAccess) {
|
|
113
|
+
this._log.info(`Cannot access native video recordings folder. ` +
|
|
114
|
+
`Make sure to grant Full Disk Access to the Appium server process.`);
|
|
115
|
+
throw new Error('Access denied');
|
|
120
116
|
}
|
|
121
|
-
|
|
117
|
+
const result = paths.find((fp) => pathMatchesUuid(fp, uuid));
|
|
118
|
+
if (!result) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
fullPath = result;
|
|
122
|
+
return true;
|
|
122
123
|
}, {
|
|
123
124
|
waitMs: RECORDING_STARTUP_TIMEOUT_MS,
|
|
124
125
|
intervalMs: 300,
|
|
125
126
|
});
|
|
126
127
|
}
|
|
127
128
|
catch {
|
|
128
|
-
this._log.warn(`The video recording identified by ${uuid} did not ` +
|
|
129
|
+
this._log.warn(`The video recording BiDi broadcast identified by ${uuid} did not ` +
|
|
129
130
|
`start within ${RECORDING_STARTUP_TIMEOUT_MS}ms timeout`);
|
|
130
131
|
return;
|
|
131
132
|
}
|
|
@@ -141,7 +142,7 @@ class NativeVideoChunksBroadcaster {
|
|
|
141
142
|
const isCompleted = stopRequested || !(await isFileUsed(fullPath, 'testman'));
|
|
142
143
|
let size;
|
|
143
144
|
try {
|
|
144
|
-
({ size } = await
|
|
145
|
+
({ size } = await fs.stat(fullPath, { bigint: true }));
|
|
145
146
|
}
|
|
146
147
|
catch (e) {
|
|
147
148
|
// The recording file may have been removed by the OS once the
|
|
@@ -155,18 +156,18 @@ class NativeVideoChunksBroadcaster {
|
|
|
155
156
|
throw e;
|
|
156
157
|
}
|
|
157
158
|
if (bytesRead < size) {
|
|
158
|
-
const handle = await
|
|
159
|
+
const handle = await fs.open(fullPath, 'r');
|
|
159
160
|
try {
|
|
160
161
|
while (bytesRead < size) {
|
|
161
162
|
const bufferSize = Number(size - bytesRead > BUFFER_SIZE ? BUFFER_SIZE : size - bytesRead);
|
|
162
163
|
const buf = Buffer.alloc(bufferSize);
|
|
163
|
-
await
|
|
164
|
-
this._ee.emit(
|
|
164
|
+
await fs.read(handle, buf, 0, bufferSize, bytesRead);
|
|
165
|
+
this._ee.emit(BIDI_EVENT_NAME, toNativeVideoChunkAddedEvent(uuid, buf));
|
|
165
166
|
bytesRead += BigInt(bufferSize);
|
|
166
167
|
}
|
|
167
168
|
}
|
|
168
169
|
finally {
|
|
169
|
-
await
|
|
170
|
+
await fs.close(handle);
|
|
170
171
|
}
|
|
171
172
|
}
|
|
172
173
|
if (isCompleted) {
|
|
@@ -177,7 +178,7 @@ class NativeVideoChunksBroadcaster {
|
|
|
177
178
|
// cancels this wakeup so the loop re-runs immediately and detects
|
|
178
179
|
// termination on the very next iteration. `cancelError: null` makes
|
|
179
180
|
// the cancel resolve the promise instead of rejecting it.
|
|
180
|
-
const wakeup =
|
|
181
|
+
const wakeup = sleep({ ms: MONITORING_INTERVAL_DURATION_MS, cancelError: null });
|
|
181
182
|
this._wakeups.set(uuid, wakeup);
|
|
182
183
|
try {
|
|
183
184
|
// Guard against a notifyStopped() that landed between the
|
|
@@ -221,21 +222,21 @@ class NativeVideoChunksBroadcaster {
|
|
|
221
222
|
if (uuids.length === 0) {
|
|
222
223
|
return;
|
|
223
224
|
}
|
|
224
|
-
const uuidSet = new Set(uuids);
|
|
225
|
-
const
|
|
226
|
-
if (
|
|
225
|
+
const uuidSet = new Set(uuids.map((uuid) => uuid.toUpperCase()));
|
|
226
|
+
const { hasAccess, paths } = await listAttachments();
|
|
227
|
+
if (!hasAccess || paths.length === 0) {
|
|
227
228
|
return;
|
|
228
229
|
}
|
|
229
|
-
const tasks =
|
|
230
|
-
.map((attachmentPath) => [
|
|
231
|
-
.filter(([name]) => uuidSet.has(name))
|
|
232
|
-
.map(([, attachmentPath]) =>
|
|
230
|
+
const tasks = paths
|
|
231
|
+
.map((attachmentPath) => [path.basename(attachmentPath), attachmentPath])
|
|
232
|
+
.filter(([name]) => uuidSet.has(name.toUpperCase()))
|
|
233
|
+
.map(([, attachmentPath]) => fs.rimraf(attachmentPath));
|
|
233
234
|
if (tasks.length === 0) {
|
|
234
235
|
return;
|
|
235
236
|
}
|
|
236
237
|
try {
|
|
237
238
|
await Promise.all(tasks);
|
|
238
|
-
this._log.debug(`Successfully deleted ${
|
|
239
|
+
this._log.debug(`Successfully deleted ${util.pluralize('leftover video recording', tasks.length, true)}`);
|
|
239
240
|
}
|
|
240
241
|
catch (e) {
|
|
241
242
|
this._log.warn(`Could not cleanup some leftover video recordings: ${e instanceof Error ? e.message : String(e)}`);
|
|
@@ -263,7 +264,6 @@ class NativeVideoChunksBroadcaster {
|
|
|
263
264
|
this._terminationRequests.delete(uuid);
|
|
264
265
|
}
|
|
265
266
|
}
|
|
266
|
-
exports.NativeVideoChunksBroadcaster = NativeVideoChunksBroadcaster;
|
|
267
267
|
/**
|
|
268
268
|
* Initiates a new native screen recording session via XCTest.
|
|
269
269
|
* If the screen recording is already running then this call results in noop.
|
|
@@ -279,7 +279,7 @@ exports.NativeVideoChunksBroadcaster = NativeVideoChunksBroadcaster;
|
|
|
279
279
|
* by default.
|
|
280
280
|
* @returns The information about the asynchronously running video recording.
|
|
281
281
|
*/
|
|
282
|
-
async function macosStartNativeScreenRecording(fps, codec, displayId) {
|
|
282
|
+
export async function macosStartNativeScreenRecording(fps, codec, displayId) {
|
|
283
283
|
const result = (await this.wda.proxy.command('/wda/video/start', 'POST', {
|
|
284
284
|
fps,
|
|
285
285
|
codec,
|
|
@@ -293,7 +293,7 @@ async function macosStartNativeScreenRecording(fps, codec, displayId) {
|
|
|
293
293
|
* @returns The information about the asynchronously running video recording or
|
|
294
294
|
* null if no native video recording has been started.
|
|
295
295
|
*/
|
|
296
|
-
async function macosGetNativeScreenRecordingInfo() {
|
|
296
|
+
export async function macosGetNativeScreenRecordingInfo() {
|
|
297
297
|
return (await this.wda.proxy.command('/wda/video', 'GET'));
|
|
298
298
|
}
|
|
299
299
|
/**
|
|
@@ -323,9 +323,9 @@ async function macosGetNativeScreenRecordingInfo() {
|
|
|
323
323
|
* or the file content cannot be uploaded to the remote location
|
|
324
324
|
* or screen recording is not supported on the device under test.
|
|
325
325
|
*/
|
|
326
|
-
async function macosStopNativeScreenRecording(remotePath, user, pass, method, headers, fileFieldName, formFields, ignorePayload) {
|
|
326
|
+
export async function macosStopNativeScreenRecording(remotePath, user, pass, method, headers, fileFieldName, formFields, ignorePayload) {
|
|
327
327
|
const response = (await this.wda.proxy.command('/wda/video/stop', 'POST', {}));
|
|
328
|
-
if (!response || !
|
|
328
|
+
if (!response || !isPlainObject(response)) {
|
|
329
329
|
throw new Error('There is no active screen recording, thus nothing to stop. Did you start it before?');
|
|
330
330
|
}
|
|
331
331
|
const { uuid } = response;
|
|
@@ -335,10 +335,10 @@ async function macosStopNativeScreenRecording(remotePath, user, pass, method, he
|
|
|
335
335
|
// in its polling sleep.
|
|
336
336
|
this._videoChunksBroadcaster.notifyStopped(uuid);
|
|
337
337
|
try {
|
|
338
|
-
await
|
|
338
|
+
await withTimeout(this._videoChunksBroadcaster.waitFor(uuid), STOP_WAIT_TIMEOUT_MS);
|
|
339
339
|
}
|
|
340
340
|
catch (e) {
|
|
341
|
-
if (e instanceof
|
|
341
|
+
if (e instanceof TimeoutError) {
|
|
342
342
|
this.log.debug(`The BiDi chunks broadcaster for the native screen recording identified ` +
|
|
343
343
|
`by ${uuid} cannot complete within ${STOP_WAIT_TIMEOUT_MS}ms timeout`);
|
|
344
344
|
}
|
|
@@ -349,15 +349,21 @@ async function macosStopNativeScreenRecording(remotePath, user, pass, method, he
|
|
|
349
349
|
if (ignorePayload) {
|
|
350
350
|
return '';
|
|
351
351
|
}
|
|
352
|
-
const
|
|
353
|
-
if (!
|
|
352
|
+
const { hasAccess, paths: attachments } = await listAttachments();
|
|
353
|
+
if (!hasAccess) {
|
|
354
354
|
throw new Error(`The screen recording identified by ${uuid} cannot be retrieved. ` +
|
|
355
355
|
`Make sure the Appium Server process or its parent process (e.g. Terminal) ` +
|
|
356
|
-
`has Full Disk Access permission enabled in 'System
|
|
357
|
-
`You may verify the presence of the recorded video manually
|
|
358
|
-
|
|
356
|
+
`has Full Disk Access permission enabled in 'System Settings' -> 'Privacy & Security' tab. ` +
|
|
357
|
+
`You may verify the presence of the recorded video manually (e.g. under ` +
|
|
358
|
+
`*/Data/Attachments/ or */Data/tmp/Attachments/ within Daemon Containers) by running ` +
|
|
359
|
+
`'find "$HOME/Library/Daemon Containers" -type f -name "${uuid}"' from Terminal ` +
|
|
359
360
|
`if the latter has been granted the above access permission.`);
|
|
360
361
|
}
|
|
362
|
+
const matchedVideoPath = attachments.find((fullPath) => pathMatchesUuid(fullPath, uuid));
|
|
363
|
+
if (!matchedVideoPath) {
|
|
364
|
+
throw new Error(`The screen recording identified by ${uuid} cannot be retrieved even ` +
|
|
365
|
+
`though the Appium Server process has Full Disk Access permission.`);
|
|
366
|
+
}
|
|
361
367
|
const options = {
|
|
362
368
|
user,
|
|
363
369
|
pass,
|
|
@@ -366,28 +372,43 @@ async function macosStopNativeScreenRecording(remotePath, user, pass, method, he
|
|
|
366
372
|
fileFieldName,
|
|
367
373
|
formFields,
|
|
368
374
|
};
|
|
369
|
-
return await
|
|
375
|
+
return await uploadRecordedMedia.bind(this)(matchedVideoPath, remotePath ?? null, options);
|
|
370
376
|
}
|
|
371
377
|
/**
|
|
372
378
|
* Fetches information about available displays
|
|
373
379
|
*
|
|
374
380
|
* @returns A map where keys are display identifiers and values are display infos
|
|
375
381
|
*/
|
|
376
|
-
async function macosListDisplays() {
|
|
382
|
+
export async function macosListDisplays() {
|
|
377
383
|
return (await this.wda.proxy.command('/wda/displays/list', 'GET'));
|
|
378
384
|
}
|
|
379
385
|
async function listAttachments() {
|
|
380
|
-
//
|
|
381
|
-
//
|
|
382
|
-
const
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
386
|
+
// e.g. .../Daemon Containers/<container-id>/Data/Attachments/<uuid>
|
|
387
|
+
// or .../Daemon Containers/<container-id>/Data/tmp/Attachments/<uuid> (Xcode 26.5+)
|
|
388
|
+
const daemonContainersRoot = path.resolve(os.homedir(), 'Library', 'Daemon Containers');
|
|
389
|
+
try {
|
|
390
|
+
await fs.access(daemonContainersRoot);
|
|
391
|
+
}
|
|
392
|
+
catch {
|
|
393
|
+
return { hasAccess: false, paths: [] };
|
|
394
|
+
}
|
|
395
|
+
try {
|
|
396
|
+
const paths = await fs.glob(DAEMON_NATIVE_RECORDING_ATTACHMENT_GLOB, {
|
|
397
|
+
cwd: daemonContainersRoot,
|
|
398
|
+
absolute: true,
|
|
399
|
+
});
|
|
400
|
+
return { hasAccess: true, paths: [...new Set(paths)] };
|
|
401
|
+
}
|
|
402
|
+
catch {
|
|
403
|
+
return { hasAccess: true, paths: [] };
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
function pathMatchesUuid(fullPath, uuid) {
|
|
407
|
+
return path.basename(fullPath).toUpperCase() === uuid.toUpperCase();
|
|
387
408
|
}
|
|
388
409
|
async function isFileUsed(fpath, userProcessName) {
|
|
389
410
|
try {
|
|
390
|
-
const { stdout } = await
|
|
411
|
+
const { stdout } = await exec('lsof', [fpath]);
|
|
391
412
|
return stdout.includes(userProcessName);
|
|
392
413
|
}
|
|
393
414
|
catch {
|