stim 1.20.2 → 1.21.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/README.md +88 -8
- package/dist/acquire-artifact-CD4lbiWE.mjs +153 -0
- package/dist/act-DHAw2A2S.mjs +2667 -0
- package/dist/activity-BzVfHSrY.mjs +1376 -0
- package/dist/{agent-device-usage-output-Dzgv6lgR.mjs → agent-device-usage-output-zh1vhbLp.mjs} +21 -65
- package/dist/{android-HqP1_vB_.mjs → android-BEJ8Jpl7.mjs} +2 -2
- package/dist/{android-DCKZrNvV.mjs → android-BLgbNqox.mjs} +128 -78
- package/dist/{android-Dlzxshgp.mjs → android-CV_GCELZ.mjs} +5 -5
- package/dist/{android-Mz_Inn3w.mjs → android-DUYkNF4u.mjs} +184 -102
- package/dist/{android-cas-Bl-cLJBk.mjs → android-cas-Ct5b1xCK.mjs} +7 -6
- package/dist/android-cas-compiler.mjs +2 -2
- package/dist/android-project-BCAAmMwz.mjs +12 -0
- package/dist/api.d.mts +740 -8
- package/dist/api.mjs +585 -1
- package/dist/{artifact-HSwkIWEQ.mjs → artifact-B8T3S5gi.mjs} +223 -201
- package/dist/{artifact-D3czlUvT.mjs → artifact-DAuZ-FNU.mjs} +158 -148
- package/dist/{browser-web-CA-F1GQo.mjs → browser-web-QQzVjz3O.mjs} +26 -24
- package/dist/budget-Bs6SxxzO.mjs +9154 -0
- package/dist/{build-DYDbfkk5.mjs → build-CoPzQRNw.mjs} +144 -96
- package/dist/build-cache-DmyR9Zzc.mjs +602 -0
- package/dist/build-plan-CaFskB7_.mjs +188 -0
- package/dist/{cache-manifest-XH-fvDUj.mjs → cache-manifest-DkkqguoK.mjs} +2 -2
- package/dist/cache-manifest.mjs +1 -1
- package/dist/{ccache-zdKiYQ3E.mjs → ccache-BJRZ9pG3.mjs} +10 -9
- package/dist/{cdp-Dq_ypAlJ.mjs → cdp-CWmIUMbw.mjs} +18 -5
- package/dist/{chrome-BnzZMqsR.mjs → chrome-B6tfCta1.mjs} +7 -4
- package/dist/{cli-CLP3diBm.mjs → cli-0DYf8QhQ.mjs} +20 -20
- package/dist/cli.mjs +1 -1
- package/dist/client-B7QVOlCr.d.mts +253 -0
- package/dist/client-UXD70ZbM.mjs +1406 -0
- package/dist/collector-run.d.mts +4 -40
- package/dist/collector-run.mjs +9 -8
- package/dist/{command-output-BTy8hZ0F.mjs → command-output-B1UrjZHL.mjs} +1 -1
- package/dist/config-CYcBF478.mjs +949 -0
- package/dist/{created-devices-Dzd5C2LF.mjs → created-devices-CqeBlrEn.mjs} +3 -3
- package/dist/{dependency-state-DG0p31-y.mjs → dependency-state-BbKQW83h.mjs} +20 -5
- package/dist/{detached-entry-B9C_zeQC.mjs → detached-entry-DFRyG1_o.mjs} +1 -1
- package/dist/{dev-client-DAWVIGBu.mjs → dev-client-UOeESKm6.mjs} +2 -2
- package/dist/device-DCxH7_By.mjs +1068 -0
- package/dist/{device-BECOiufl.mjs → device-ExJq8Ei7.mjs} +35 -35
- package/dist/{device-capacity-CBUAcRyQ.mjs → device-capacity-CMlqEcvw.mjs} +43 -13
- package/dist/device-host-worker.mjs +65 -61
- package/dist/{device-ios-COSi6oS1.mjs → device-ios-DRUeKaFV.mjs} +48 -45
- package/dist/{device-lease-run-Cw2M4z51.mjs → device-lease-run-C8raGFoP.mjs} +14 -26
- package/dist/{device-pool-Bf-pOhSw.mjs → device-pool-DMRpVX9a.mjs} +5 -5
- package/dist/doctor-BLHCYxzi.mjs +2 -0
- package/dist/{doctor-kfMBnUw6.mjs → doctor-DTvaDOda.mjs} +281 -317
- package/dist/{doctor-CB8oZKCk.mjs → doctor-Dhqebm0q.mjs} +183 -91
- package/dist/doctor-fingerprint.mjs +19 -0
- package/dist/{doctor-watchman-BRyV2adA.mjs → doctor-watchman-Cv1F10Kj.mjs} +40 -21
- package/dist/{eas-build-JyfqyHfC.mjs → eas-build-BomfRnFT.mjs} +53 -20
- package/dist/{build-plan-B7SZsc2N.mjs → eas-fallback-DJwZpy0c.mjs} +26 -208
- package/dist/{watchman-CPQFZLXY.mjs → eas-session-ledger-op6A54yi.mjs} +229 -11
- package/dist/{error-diagnostics-BR677IDM.mjs → error-diagnostics-Bf0rZvG9.mjs} +172 -82
- package/dist/exec-H20xSg2T.d.mts +65 -0
- package/dist/exec-_UbtCQcG.mjs +750 -0
- package/dist/gc-C-WwL0yi.mjs +3 -0
- package/dist/{gc-qWOMdnER.mjs → gc-_-dCXdyL.mjs} +584 -796
- package/dist/git-C3iTsJaZ.mjs +73 -0
- package/dist/{guide-G9cAbVAc.mjs → guide-Yqwt2bd6.mjs} +941 -269
- package/dist/{hosted-android-C3MHGld1.mjs → hosted-android-Bw-honsd.mjs} +8 -6
- package/dist/{hosted-client-ZEKpS9vw.mjs → hosted-client-DB_gBPfY.mjs} +34 -19
- package/dist/{hosted-ios-l-o3iM9J.mjs → hosted-ios-CUvOf4Vr.mjs} +1 -1
- package/dist/{hosted-logs-EzQM7-3Z.mjs → hosted-logs-DL_P5AdN.mjs} +77 -43
- package/dist/{hosted-macos-BACVAVqE.mjs → hosted-macos-QI141yKk.mjs} +21 -17
- package/dist/{hosted-native-A4s1QPXe.mjs → hosted-native-Ksyjgzq-.mjs} +30 -21
- package/dist/idle-BVeRGroT.d.mts +24 -0
- package/dist/{idle-shutdown-DtxhPTKe.mjs → idle-shutdown-DaKmZi0z.mjs} +11 -10
- package/dist/{ios-BwVCF7oA.mjs → ios-CQ68hG9s.mjs} +8 -8
- package/dist/{ios-RkW4pnQf.mjs → ios-CpByZy12.mjs} +140 -80
- package/dist/{ios-device-B5veSDDQ.mjs → ios-device-CXGP1bsD.mjs} +1 -1
- package/dist/{ios-device-D7pi2Sca.mjs → ios-device-CwFMehUS.mjs} +51 -26
- package/dist/{ios-project-K9hY_Jab.mjs → ios-project-WuwwBdvW.mjs} +13 -13
- package/dist/{ios-nOLJGVdy.mjs → ios-qNJt4dFm.mjs} +1 -1
- package/dist/ios-signing-DTTIChGs.mjs +489 -0
- package/dist/{ios-state-CBLe1xYw.mjs → ios-state-DvFX-K_l.mjs} +1 -1
- package/dist/{ios-Ce7bc7br.mjs → ios-ubFsBzwq.mjs} +129 -86
- package/dist/{js-swap-Bb3nsS07.mjs → js-swap-Cc1dttps.mjs} +53 -26
- package/dist/{launch-F4sOqAhB.mjs → launch-CD1yVc7U.mjs} +91 -90
- package/dist/{launch-C3qJ6Agb.mjs → launch-Zq2mOSDy.mjs} +82 -541
- package/dist/logs-BS00Anxf.mjs +352 -0
- package/dist/logs-CMm05HxN.mjs +255 -0
- package/dist/{macos-D7uDvO-z.mjs → macos-B65--pPd.mjs} +1 -1
- package/dist/{macos-Ch5VJmcS.mjs → macos-C-0qJ6zq.mjs} +225 -212
- package/dist/macos-run.mjs +1 -1
- package/dist/maintenance-run.mjs +122 -247
- package/dist/{metro-DnCEjCxs.mjs → metro-DEXpIhHC.mjs} +67 -12
- package/dist/{metro-gateway-CX9Xlkq2.mjs → metro-gateway-BMJNlj3E.mjs} +20 -12
- package/dist/{named-ports-4WopRPg-.mjs → named-ports-BWTzt6mu.mjs} +8 -63
- package/dist/native-android-JACyjTZs.mjs +844 -0
- package/dist/{native-gradle-inputs-BsLRrl7u.mjs → native-gradle-inputs-Bep9JcSF.mjs} +128 -140
- package/dist/native-inputs-TRTTTRxt.mjs +91 -0
- package/dist/native-run-DY_RLx3C.mjs +277 -0
- package/dist/{native-runtime-k8dTIrbK.mjs → native-runtime-Dg1Q7tfF.mjs} +9 -8
- package/dist/{native-xcode-inputs-CykopJdM.mjs → native-xcode-inputs-CB2iQeWq.mjs} +27 -18
- package/dist/{native-xcode-ios-Bbf30Gm0.mjs → native-xcode-ios-CXX39F7o.mjs} +96 -47
- package/dist/{ndjson-GOnbyvso.mjs → ndjson-CgE_o3Dl.mjs} +3 -3
- package/dist/offload-worker.d.mts +1 -46
- package/dist/offload-worker.mjs +197 -66
- package/dist/{ownership-DCtw_2IA.mjs → ownership-DEmM5vhh.mjs} +3 -3
- package/dist/{page-DRHy329N.mjs → page-CPaHeYqj.mjs} +7 -4
- package/dist/paths-BsJMoPP2.mjs +12 -0
- package/dist/paths-DQtTgsBf.mjs +42 -0
- package/dist/{placement-log-MOfPVgaM.mjs → placement-log-BqGbTa61.mjs} +5 -5
- package/dist/{plan-placement-V0TdzYXp.mjs → plan-placement-Bwj-IjY1.mjs} +6 -6
- package/dist/{ports-DdSUicVo.mjs → ports-D-MmCTdv.mjs} +3 -3
- package/dist/prebuild-uD_ipCxF.mjs +449 -0
- package/dist/{project-_phNIJfs.mjs → project-BZNjmW_8.mjs} +65 -37
- package/dist/{pull-request-CQ8sPbZa.mjs → pull-request-Lfetn8Kr.mjs} +2 -2
- package/dist/pull-request-zjCSAryH.d.mts +120 -0
- package/dist/pull-requests.d.mts +1 -119
- package/dist/pull-requests.mjs +1 -1
- package/dist/{react-native-android-CM1XRDwv.mjs → react-native-android-DuzH0cn3.mjs} +74 -48
- package/dist/{gradle-DSrXb6lG.mjs → react-native-build-rhk4smwQ.mjs} +292 -15
- package/dist/react-native-doctor-CQpuIMso.mjs +234 -0
- package/dist/{react-native-ios-Dhq_eiYQ.mjs → react-native-ios-Bhq1rJeV.mjs} +46 -28
- package/dist/{recordings-D0d5aQt0.mjs → recordings-DYteQSu4.mjs} +12 -9
- package/dist/{reload-C8JhxjSh.mjs → reload-CmTRFJaX.mjs} +93 -47
- package/dist/reload-DzjSl5P_.mjs +2 -0
- package/dist/{remote-BiR6aYjy.mjs → remote-ByYkXdGD.mjs} +15 -10
- package/dist/result-DNiS-tTP.mjs +434 -0
- package/dist/{run-BtPgpKks.mjs → run-D23HmJMs.mjs} +4 -5
- package/dist/selection-CSl9i5qU.mjs +619 -0
- package/dist/{server-bare-R2m_gsH8.mjs → server-bare-CxTrvDg8.mjs} +3 -4
- package/dist/{server-command-CTtCkmcQ.mjs → server-command-CtzloH3v.mjs} +14 -7
- package/dist/server-expo-C-90EhcG.mjs +2 -0
- package/dist/{server-expo-DsguMGUF.mjs → server-expo-DT_F_uVI.mjs} +50 -9
- package/dist/{settings-B717odTD.mjs → settings-CsJDEXgK.mjs} +234 -24
- package/dist/{settings-vk3mJGSm.d.mts → settings-DkdmlelE.d.mts} +6 -4
- package/dist/settings-T1gtc3bf.mjs +114 -0
- package/dist/settings-write-HyVZ8eQ8.mjs +359 -0
- package/dist/settings.schema.json +163 -16
- package/dist/{simslim-CCr3rE-A.mjs → simslim-Cgk17SXV.mjs} +14 -12
- package/dist/{slot-launch-DPt0m9Nd.mjs → slot-launch-DF8VfT64.mjs} +15 -20
- package/dist/{spawn-entry-Dcb7sDUz.mjs → spawn-entry-jw19m8Nl.mjs} +0 -1
- package/dist/stage-BIS0ydsV.mjs +183 -0
- package/dist/{start-BWqzODpb.mjs → start-7lpH7hmN.mjs} +63 -44
- package/dist/{start-TXeMmmO2.mjs → start-RChynRDp.mjs} +1 -1
- package/dist/{state-D1Icyjlu.mjs → state-C4ZtUisW.mjs} +40 -13
- package/dist/{state-CG_OFoaA.mjs → state-XMziexv2.mjs} +3 -2
- package/dist/{stats-BoY5sEPU.mjs → stats-53T7OTb9.mjs} +7 -13
- package/dist/stats-report-BFfMpWWF.mjs +16 -0
- package/dist/{status-WgFbkRzj.mjs → status-BL7jVyAB.mjs} +535 -447
- package/dist/status-CSi6tlRq.mjs +2 -0
- package/dist/{status-BTA7kKiQ.mjs → status-DqEUSSxs.mjs} +6 -4
- package/dist/{status-watch-C23ILtf9.mjs → status-watch-GDCfqpTE.mjs} +187 -22
- package/dist/status-worker.d.mts +1 -0
- package/dist/status-worker.mjs +19 -0
- package/dist/stim-desktop-C12we7lz.mjs +112 -0
- package/dist/{stop-DR6VoDIk.mjs → stop-Bk_1qiV6.mjs} +2 -2
- package/dist/{stop-BNmBMi1F.mjs → stop-CPzlM1L-.mjs} +138 -98
- package/dist/{stop-DPEhunlw.mjs → stop-D7h6jAXQ.mjs} +11 -10
- package/dist/supervisor-run.d.mts +8 -17
- package/dist/supervisor-run.mjs +63 -27
- package/dist/{support-DMTqj3Hm.mjs → support-67vraa1Q.mjs} +18 -11
- package/dist/{support-CwjbFs9H.mjs → support-Dlu37g6H.mjs} +12 -12
- package/dist/{swiftpm-macos-DRNVJWlb.mjs → swiftpm-macos-p8WZbxKU.mjs} +35 -24
- package/dist/toolchain-DhKwp9iI.mjs +2 -0
- package/dist/toolchain-Hp9sCpK4.mjs +873 -0
- package/dist/{trigger-CigAYjeL.mjs → trigger-BAahxUPq.mjs} +20 -5
- package/dist/trigger-Bf3uDcpv.mjs +2 -0
- package/dist/{warm-progress-BuY-Fvfn.mjs → warm-progress-BHX5r0Ei.mjs} +250 -156
- package/dist/{web-BDBMxDpx.mjs → web-CJmIj6AI.mjs} +18 -13
- package/dist/web-DknQETPs.mjs +2 -0
- package/dist/web-run.mjs +11 -12
- package/dist/windows-report.d.mts +1 -0
- package/dist/windows-report.mjs +18 -0
- package/dist/windows-report.ps1 +43 -0
- package/dist/workspace-process-lock-1_1OoVW5.mjs +57 -0
- package/dist/{workspace-state-DJt_MMvf.mjs → workspace-state-Cjuigeeu.mjs} +62 -58
- package/dist/{workspaces-C36s2jb9.mjs → workspaces-BccMFmGQ.mjs} +1188 -1079
- package/dist/worktree-CK2MpJW5.mjs +2 -0
- package/dist/{worktree-CgvJYJ-Q.mjs → worktree-DQ6Zi2Mv.mjs} +304 -53
- package/dist/xcode-Zlx3qjEs.mjs +896 -0
- package/package.json +7 -5
- package/shim/android-optimizations.gradle +7 -5
- package/dist/activity-BSV745Kz.mjs +0 -629
- package/dist/api-qvOzWyfO.mjs +0 -154
- package/dist/api-run.mjs +0 -294
- package/dist/app-install-BIKtMfPq.mjs +0 -896
- package/dist/artifact-lifecycle-DzPpBYvK.mjs +0 -30
- package/dist/budget-f7516Zk0.mjs +0 -4106
- package/dist/build-facts-DcLv2HSd.d.mts +0 -111
- package/dist/cancellation-C_22VQTH.mjs +0 -24
- package/dist/client-qQAaXSUs.mjs +0 -1771
- package/dist/config-BYDxlMY3.mjs +0 -562
- package/dist/device-DuiPJQSn.mjs +0 -290
- package/dist/device-lease-BX1sJQ2E.mjs +0 -1224
- package/dist/device-remote-xRT0Vmo9.mjs +0 -1272
- package/dist/eas-session-ledger-Cm0Gwq2F.mjs +0 -207
- package/dist/exec-DqKo9GKJ.mjs +0 -268
- package/dist/git-DDfFzkMm.mjs +0 -45
- package/dist/launch-verify-B6Q8hZP-.mjs +0 -428
- package/dist/logs-BGrEUaEs.mjs +0 -383
- package/dist/miss-reason-mKzZ4VvN.mjs +0 -238
- package/dist/native-android-D5qc3-_v.mjs +0 -226
- package/dist/ndjson-Du3j0AQ9.d.mts +0 -17
- package/dist/plan-C4TjdPsR.mjs +0 -260
- package/dist/prebuild-DYbucPXy.mjs +0 -212
- package/dist/preview-78a9kR_-.mjs +0 -1011
- package/dist/react-native-build-CtCccJtb.mjs +0 -239
- package/dist/react-native-doctor-CfRnFfjs.mjs +0 -78
- package/dist/remote-cache-OyOyVIS3.mjs +0 -526
- package/dist/result-CaJg5Iat.mjs +0 -186
- package/dist/server-expo-Bigriskl.mjs +0 -2
- package/dist/settings-BORNaaCO.mjs +0 -402
- package/dist/spawn-claims-DVS5RkMS.mjs +0 -72
- package/dist/stage-KNTQopqv.mjs +0 -157
- package/dist/stim-desktop-BzBN2Em2.mjs +0 -63
- package/dist/tailnet-Dh-qiYzG.mjs +0 -265
- package/dist/toolchain-BFkAcstd.mjs +0 -2
- package/dist/toolchain-DxSsNssu.mjs +0 -1657
- package/dist/trigger-9_USgmxz.mjs +0 -2
- package/dist/web-Dq-i3wzJ.mjs +0 -2
- package/dist/worktree-DpLdCHga.mjs +0 -2
- package/dist/{api-run.d.mts → doctor-fingerprint.d.mts} +0 -0
- package/dist/{errors-DzkMYh8Q.mjs → errors-ccaPc4ox.mjs} +2 -2
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { A as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { a as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { t as
|
|
14
|
-
import { i as stopHostedAndroid } from "./hosted-android-
|
|
15
|
-
import {
|
|
16
|
-
import { n as
|
|
17
|
-
import {
|
|
18
|
-
import { n as stopMacosApp } from "./stop-DPEhunlw.mjs";
|
|
1
|
+
import { _ as debugLog, f as ownership_claim_exports, p as process_identity_exports } from "./exec-_UbtCQcG.mjs";
|
|
2
|
+
import { d as workspaceDir } from "./paths-DQtTgsBf.mjs";
|
|
3
|
+
import { E as upsertProject, G as parseDeviceSlotOption, J as validateDeviceSlot, K as projectDeviceSlots, O as withConfigLockAsync$1, U as deviceSlotPlatforms, W as parseDeviceSlotKey, o as clearSupervisor, p as getProject } from "./config-CYcBF478.mjs";
|
|
4
|
+
import { f as refuseNoProject, l as phaseLine, p as releasedLeaseFact, u as plural } from "./command-output-B1UrjZHL.mjs";
|
|
5
|
+
import { c as withWorkspaceStateLock, d as writeWorkspaceState, l as withWorkspaceStateLockAsync, n as clearWorkspaceStateKeys, r as readWorkspaceState$1, s as updateWorkspaceStateAsync } from "./workspace-state-Cjuigeeu.mjs";
|
|
6
|
+
import { A as clearWorkspaceLaunches, M as readMetroTunnel, O as clearManagedMetroTunnel, P as readRemoteSession, T as MODE_COMMAND, j as clearWorkspaceSupervisor, k as clearRemoteSession, n as findCommandWorkspace } from "./project-BZNjmW_8.mjs";
|
|
7
|
+
import { t as macosAppPresent } from "./state-XMziexv2.mjs";
|
|
8
|
+
import { d as processCwds, f as resolveProjectMetro, g as isMetroRunning, i as killMetroTreeAsync, l as pidExists, m as signalProcessTreeAsync, o as listeningPidsAsync } from "./metro-DEXpIhHC.mjs";
|
|
9
|
+
import { S as withdrawDevServerStopRequest, b as requestDevServerStop, qn as resolveEasCliBin, v as logVanishedSupervisor, zt as endRecordedSession } from "./budget-Bs6SxxzO.mjs";
|
|
10
|
+
import { a as decideStopAction, c as nativeRunWaitNotice, i as clearNativeRunCancel, l as requestNativeRunCancel, n as NATIVE_RUN_WAIT_MS, o as describeNativeRunHolder, s as nativeRunHolder, t as NATIVE_RUN_LOCK } from "./native-run-DY_RLx3C.mjs";
|
|
11
|
+
import { D as teardownOwnedBrowser, E as teardownOwnedAvd, O as teardownOwnedIosSim, g as stopTunnel, m as resolveSupervisorTarget } from "./workspaces-BccMFmGQ.mjs";
|
|
12
|
+
import { O as releaseWorkspaceLeasesAsync, y as fileLeaseIo } from "./activity-BzVfHSrY.mjs";
|
|
13
|
+
import { t as withWorkspaceProcessLock } from "./workspace-process-lock-1_1OoVW5.mjs";
|
|
14
|
+
import { i as stopHostedAndroid } from "./hosted-android-Bw-honsd.mjs";
|
|
15
|
+
import { r as stopHostedIos } from "./hosted-ios-CUvOf4Vr.mjs";
|
|
16
|
+
import { n as stopMacosApp } from "./stop-D7h6jAXQ.mjs";
|
|
17
|
+
import { n as verifyCollectorOwnership } from "./ownership-DEmM5vhh.mjs";
|
|
19
18
|
import { hostedAndroidDeviceName, hostedAndroidRecords, hostedIosRecords, hostedNativeRecords, isJsonObject, parseHostedNativePlacement } from "@stim-cli/core/state";
|
|
20
19
|
import chalk from "chalk";
|
|
21
20
|
//#region src/commands/stop.ts
|
|
@@ -103,20 +102,21 @@ function resolveCollectorTargets({ root, collectors, isAlive = pidExists, selfPi
|
|
|
103
102
|
}
|
|
104
103
|
return targets;
|
|
105
104
|
}
|
|
106
|
-
function defaultTeardownRemoteSession(root, sessionId) {
|
|
105
|
+
async function defaultTeardownRemoteSession(root, sessionId, operation) {
|
|
107
106
|
return endRecordedSession({
|
|
108
107
|
root,
|
|
109
108
|
sessionId,
|
|
110
|
-
easBin: resolveEasCliBin(root)?.file ?? null
|
|
109
|
+
easBin: resolveEasCliBin(root)?.file ?? null,
|
|
110
|
+
operation
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
|
-
function endRemoteSession(root, sessionId, { teardownRemoteSession, report }) {
|
|
114
|
-
const result = teardownRemoteSession(root, sessionId);
|
|
113
|
+
async function endRemoteSession(root, sessionId, { teardownRemoteSession, report }) {
|
|
114
|
+
const result = await teardownRemoteSession(root, sessionId);
|
|
115
115
|
if (result.status === "failed") report(chalk.red(phaseLine("device", result.reason ?? `could not stop remote session ${sessionId}`)));
|
|
116
116
|
else {
|
|
117
117
|
report(chalk.dim(phaseLine("device", `stopped remote session ${sessionId}`)));
|
|
118
118
|
if (result.reason) report(chalk.yellow(phaseLine("device", result.reason)));
|
|
119
|
-
else clearRemoteSession(root, sessionId);
|
|
119
|
+
else await withWorkspaceStateLockAsync(root, () => clearRemoteSession(root, sessionId));
|
|
120
120
|
}
|
|
121
121
|
return {
|
|
122
122
|
status: result.status,
|
|
@@ -148,19 +148,19 @@ async function runStop(options) {
|
|
|
148
148
|
collectors,
|
|
149
149
|
remoteDevice: null,
|
|
150
150
|
metroTunnel: null,
|
|
151
|
-
clearCollectors: (projectRoot, expected) =>
|
|
151
|
+
clearCollectors: (projectRoot, expected) => withWorkspaceStateLockAsync(projectRoot, () => {
|
|
152
152
|
clearCollectorState(projectRoot, expected);
|
|
153
153
|
return !Object.keys(readCollectorState(projectRoot)).some((key) => parseDeviceSlotKey(key)?.slot === slot);
|
|
154
154
|
}),
|
|
155
|
-
clearState: (projectRoot) => {
|
|
155
|
+
clearState: (projectRoot) => withWorkspaceStateLockAsync(projectRoot, () => {
|
|
156
156
|
clearWorkspaceLaunches(projectRoot, slot);
|
|
157
157
|
return true;
|
|
158
|
-
},
|
|
158
|
+
}),
|
|
159
159
|
clearRegistration: async () => true,
|
|
160
160
|
teardownBrowser: null,
|
|
161
161
|
stopMacos: false,
|
|
162
162
|
hostedSlot: slot,
|
|
163
|
-
releaseLeases: (projectRoot) =>
|
|
163
|
+
releaseLeases: (projectRoot) => releaseWorkspaceLeasesAsync(projectRoot, { slot })
|
|
164
164
|
});
|
|
165
165
|
result.outcomes.port = {
|
|
166
166
|
status: "kept",
|
|
@@ -262,7 +262,11 @@ async function stopWorkspaceMacos(root, failed, enabled) {
|
|
|
262
262
|
};
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
|
-
async function stopWorkspace({ root, project = void 0, state = void 0, collectors = void 0, signalCollector = (pid) =>
|
|
265
|
+
async function stopWorkspace({ root, operation, project = void 0, state = void 0, collectors = void 0, signalCollector = (pid) => signalProcessTreeAsync(pid), verifyCollector = verifyCollectorOwnership, clearCollectors = (projectRoot, expected) => withWorkspaceStateLockAsync(projectRoot, () => clearCollectorState(projectRoot, expected)), isAlive = pidExists, killGroup = killMetroTreeAsync, signalServer = (pid, group) => signalProcessTreeAsync(pid, "SIGTERM", { group }), inspectIdentity = process_identity_exports.inspectProcessIdentity, waitForDeath = void 0, waitMs = DEFAULT_WAIT_MS, resolveMetro = (port, projectRoot) => resolveProjectMetro(port, projectRoot, {
|
|
266
|
+
probe: (candidatePort) => isMetroRunning(candidatePort, operation?.signal),
|
|
267
|
+
pidsOf: listeningPidsAsync,
|
|
268
|
+
cwdOf: async (pid) => (await processCwds([pid])).get(pid) ?? null
|
|
269
|
+
}), teardownIos = teardownOwnedIosSim, teardownAvd = teardownOwnedAvd, teardownBrowser = (projectRoot) => teardownOwnedBrowser(projectRoot), stopMacos, hostedSlot, remoteDevice = void 0, teardownRemoteSession = (projectRoot, id) => defaultTeardownRemoteSession(projectRoot, id, operation), metroTunnel = void 0, stopMetroTunnel = stopTunnel, releaseLeases = releaseWorkspaceLeasesAsync, freePort = defaultFreePort, clearRegistration = (projectRoot, expected) => defaultClearRegistration(projectRoot, expected, report), clearState = (projectRoot, expected) => withWorkspaceStateLockAsync(projectRoot, () => clearSupervisorState(projectRoot, expected)), report = (line) => console.error(line) }) {
|
|
266
270
|
const proj = project === void 0 ? getProject(root) : project;
|
|
267
271
|
const sup = state === void 0 ? readSupervisorState(root) : state;
|
|
268
272
|
const collectorRecords = collectors === void 0 ? readCollectorState(root) : collectors;
|
|
@@ -352,7 +356,7 @@ async function stopWorkspace({ root, project = void 0, state = void 0, collector
|
|
|
352
356
|
stillHolding ??= "a collector could not be stopped";
|
|
353
357
|
} else if (outcomes.collectors.entries.length) {
|
|
354
358
|
debugLog.log("stop.phase.start", { phase: "clear-collectors" });
|
|
355
|
-
const cleared = clearCollectors(root, collectorRecords);
|
|
359
|
+
const cleared = await clearCollectors(root, collectorRecords);
|
|
356
360
|
debugLog.log("stop.phase.end", {
|
|
357
361
|
phase: "clear-collectors",
|
|
358
362
|
cleared
|
|
@@ -389,8 +393,17 @@ async function stopWorkspace({ root, project = void 0, state = void 0, collector
|
|
|
389
393
|
}
|
|
390
394
|
}
|
|
391
395
|
const releaseStoppedSupervisor = async () => {
|
|
392
|
-
const stateCleared = clearState(root, sup);
|
|
396
|
+
const stateCleared = await clearState(root, sup);
|
|
393
397
|
const registrationCleared = await clearRegistration(root, proj?.supervisor ?? null);
|
|
398
|
+
if (typeof registrationCleared === "object") {
|
|
399
|
+
ok = false;
|
|
400
|
+
outcomes.port = {
|
|
401
|
+
status: "kept",
|
|
402
|
+
port: reservedPort,
|
|
403
|
+
reason: registrationCleared.error
|
|
404
|
+
};
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
394
407
|
if (stateCleared === false || registrationCleared === false) {
|
|
395
408
|
ok = false;
|
|
396
409
|
outcomes.port = {
|
|
@@ -410,7 +423,7 @@ async function stopWorkspace({ root, project = void 0, state = void 0, collector
|
|
|
410
423
|
report(chalk.dim(phaseLine("port", `keeping reservation ${reservedPort} -- ${keepPort}`)));
|
|
411
424
|
return;
|
|
412
425
|
}
|
|
413
|
-
if (freePort(root, reservedPort) === false) {
|
|
426
|
+
if (await freePort(root, reservedPort) === false) {
|
|
414
427
|
ok = false;
|
|
415
428
|
outcomes.port = {
|
|
416
429
|
status: "kept",
|
|
@@ -428,7 +441,7 @@ async function stopWorkspace({ root, project = void 0, state = void 0, collector
|
|
|
428
441
|
};
|
|
429
442
|
if (stillHolding) report(chalk.dim(phaseLine("device", "left alone (something is still running)")));
|
|
430
443
|
else {
|
|
431
|
-
outcomes.device = shutDownDevices(proj, root, {
|
|
444
|
+
outcomes.device = await shutDownDevices(proj, root, {
|
|
432
445
|
teardownIos,
|
|
433
446
|
teardownAvd,
|
|
434
447
|
report
|
|
@@ -445,7 +458,7 @@ async function stopWorkspace({ root, project = void 0, state = void 0, collector
|
|
|
445
458
|
ok = false;
|
|
446
459
|
});
|
|
447
460
|
Object.assign(outcomes.device, hosted.devices);
|
|
448
|
-
|
|
461
|
+
await updateWorkspaceStateAsync(root, (workspace) => {
|
|
449
462
|
const slots = isJsonObject(workspace.deviceSlots) ? workspace.deviceSlots : {};
|
|
450
463
|
for (const name of ["default", ...Object.keys(slots)]) {
|
|
451
464
|
if (hostedSlot !== void 0 && name !== hostedSlot) continue;
|
|
@@ -463,7 +476,7 @@ async function stopWorkspace({ root, project = void 0, state = void 0, collector
|
|
|
463
476
|
const remote = remoteDevice === void 0 ? readRemoteSession(root) : remoteDevice;
|
|
464
477
|
const sessionId = typeof remote?.sessionId === "string" ? remote.sessionId : null;
|
|
465
478
|
if (sessionId) {
|
|
466
|
-
outcomes.device.remote = endRemoteSession(root, sessionId, {
|
|
479
|
+
outcomes.device.remote = await endRemoteSession(root, sessionId, {
|
|
467
480
|
teardownRemoteSession,
|
|
468
481
|
report
|
|
469
482
|
});
|
|
@@ -483,7 +496,7 @@ async function stopWorkspace({ root, project = void 0, state = void 0, collector
|
|
|
483
496
|
tunnelHolding = result.reason ?? `could not stop the ${tunnel.provider} tunnel`;
|
|
484
497
|
if (!stillHolding) stillHolding = tunnelHolding;
|
|
485
498
|
report(chalk.red(phaseLine("lan", tunnelHolding)));
|
|
486
|
-
} else if (!clearManagedMetroTunnel(root, tunnel)) {
|
|
499
|
+
} else if (!await withWorkspaceStateLockAsync(root, () => clearManagedMetroTunnel(root, tunnel))) {
|
|
487
500
|
tunnelHolding = "a replacement managed tunnel record appeared during cleanup and remains active";
|
|
488
501
|
stillHolding = stillHolding ?? tunnelHolding;
|
|
489
502
|
ok = false;
|
|
@@ -495,7 +508,7 @@ async function stopWorkspace({ root, project = void 0, state = void 0, collector
|
|
|
495
508
|
report(chalk.red(phaseLine("lan", tunnelHolding)));
|
|
496
509
|
} else report(chalk.dim(phaseLine("lan", result.status === "missing" ? "tunnel already gone" : `stopped the ${tunnel.provider} tunnel`)));
|
|
497
510
|
} else if (tunnel?.kind === "expo") outcomes.metroTunnel = { status: "not-managed" };
|
|
498
|
-
outcomes.releasedLeases = releaseLeases(root);
|
|
511
|
+
outcomes.releasedLeases = await releaseLeases(root);
|
|
499
512
|
for (const lease of outcomes.releasedLeases) report(chalk.dim(phaseLine("lease", releasedLeaseFact(lease))));
|
|
500
513
|
if (stillHolding) {
|
|
501
514
|
outcomes.port = {
|
|
@@ -510,7 +523,7 @@ async function stopWorkspace({ root, project = void 0, state = void 0, collector
|
|
|
510
523
|
"stopped"
|
|
511
524
|
].includes(outcomes.supervisor.status) && !["refused", "failed"].includes(outcomes.metro.status);
|
|
512
525
|
if (tunnelHolding && serverIsDown) {
|
|
513
|
-
clearState(root, sup);
|
|
526
|
+
await clearState(root, sup);
|
|
514
527
|
await clearRegistration(root, proj?.supervisor ?? null);
|
|
515
528
|
}
|
|
516
529
|
} else await releaseStoppedSupervisor();
|
|
@@ -574,7 +587,7 @@ async function reapCollectors(root, collectors, { isAlive, signal, report, verif
|
|
|
574
587
|
});
|
|
575
588
|
continue;
|
|
576
589
|
}
|
|
577
|
-
signal(target.pid);
|
|
590
|
+
await signal(target.pid);
|
|
578
591
|
if (!await waiter(target.pid, collectors?.[target.platform]?.processToken)) {
|
|
579
592
|
entries.push({
|
|
580
593
|
platform: target.platform,
|
|
@@ -614,16 +627,20 @@ async function reapCollectors(root, collectors, { isAlive, signal, report, verif
|
|
|
614
627
|
}
|
|
615
628
|
async function stopSupervisor(target, { root, killGroup, waiter, report }) {
|
|
616
629
|
report(chalk.dim(phaseLine("stop", `sending SIGTERM to supervisor process group ${target.pid}`)));
|
|
617
|
-
|
|
630
|
+
try {
|
|
631
|
+
await withWorkspaceStateLockAsync(root, () => requestDevServerStop(root, target.processToken, { by: "stim stop" }));
|
|
632
|
+
} catch {}
|
|
618
633
|
let signalled = false;
|
|
619
634
|
try {
|
|
620
|
-
signalled = killGroup(target.pid, target.processToken);
|
|
635
|
+
signalled = await killGroup(target.pid, target.processToken);
|
|
621
636
|
} catch (e) {
|
|
622
637
|
signalled = false;
|
|
623
638
|
report(chalk.red(phaseLine("stop", `could not signal supervisor pid ${target.pid}: ${String(e?.message || e)}`)));
|
|
624
639
|
}
|
|
625
640
|
if (!signalled) {
|
|
626
|
-
|
|
641
|
+
try {
|
|
642
|
+
await withWorkspaceStateLockAsync(root, () => withdrawDevServerStopRequest(root, target.processToken));
|
|
643
|
+
} catch {}
|
|
627
644
|
const reason = `could not signal supervisor pid ${target.pid}`;
|
|
628
645
|
report(chalk.red(phaseLine("stop", reason)));
|
|
629
646
|
return {
|
|
@@ -678,7 +695,7 @@ async function stopMetro(port, root, { server, supervisorGone, signalServer, ins
|
|
|
678
695
|
report(chalk.dim(phaseLine("metro", `sending SIGTERM to dev server pid ${serverPid} left by the supervisor`)));
|
|
679
696
|
let signalled = false;
|
|
680
697
|
try {
|
|
681
|
-
signalled = signalServer(serverPid, server?.mode === MODE_COMMAND);
|
|
698
|
+
signalled = await signalServer(serverPid, server?.mode === MODE_COMMAND);
|
|
682
699
|
} catch {}
|
|
683
700
|
if (signalled ? await waiter(serverPid, serverProcessToken) : ["gone", "different"].includes(inspectIdentity(serverRecord))) {
|
|
684
701
|
report(chalk.green(phaseLine("metro", `dev server pid ${serverPid}`)));
|
|
@@ -730,7 +747,7 @@ function occupiedSkipReason(reason, holders) {
|
|
|
730
747
|
const named = (holders || []).filter(Boolean);
|
|
731
748
|
return named.length ? `${reason} -- held by UI-test runner ${named.join(", ")}` : `${reason} -- ${OCCUPANCY_HINT}`;
|
|
732
749
|
}
|
|
733
|
-
function shutDownDevices(project, workspace, { teardownIos, teardownAvd, report }) {
|
|
750
|
+
async function shutDownDevices(project, workspace, { teardownIos, teardownAvd, report }) {
|
|
734
751
|
const device = {
|
|
735
752
|
ios: null,
|
|
736
753
|
android: null
|
|
@@ -756,7 +773,7 @@ function shutDownDevices(project, workspace, { teardownIos, teardownAvd, report
|
|
|
756
773
|
slot,
|
|
757
774
|
deviceId: iosUdid
|
|
758
775
|
});
|
|
759
|
-
const result = teardownIos(iosUdid, {
|
|
776
|
+
const result = await teardownIos(iosUdid, {
|
|
760
777
|
del: false,
|
|
761
778
|
label: iosName,
|
|
762
779
|
workspace
|
|
@@ -786,7 +803,7 @@ function shutDownDevices(project, workspace, { teardownIos, teardownAvd, report
|
|
|
786
803
|
slot,
|
|
787
804
|
deviceId: android.avdName
|
|
788
805
|
});
|
|
789
|
-
const result = teardownAvd(android.avdName, {
|
|
806
|
+
const result = await teardownAvd(android.avdName, {
|
|
790
807
|
del: false,
|
|
791
808
|
workspace
|
|
792
809
|
});
|
|
@@ -895,7 +912,7 @@ function summarize(root, outcomes, ok) {
|
|
|
895
912
|
return `${ok ? "Stopped" : "Stopped with problems"}: ${what} (${root})`;
|
|
896
913
|
}
|
|
897
914
|
function defaultFreePort(root, port) {
|
|
898
|
-
return
|
|
915
|
+
return withConfigLockAsync$1(() => {
|
|
899
916
|
const current = getProject(root);
|
|
900
917
|
if (!current) return true;
|
|
901
918
|
if (current.supervisor || current.metroPort !== port) return false;
|
|
@@ -903,11 +920,13 @@ function defaultFreePort(root, port) {
|
|
|
903
920
|
return true;
|
|
904
921
|
});
|
|
905
922
|
}
|
|
906
|
-
async function defaultClearRegistration(root, expected) {
|
|
923
|
+
async function defaultClearRegistration(root, expected, report) {
|
|
907
924
|
try {
|
|
908
|
-
return clearSupervisor(root, expected);
|
|
909
|
-
} catch {
|
|
910
|
-
|
|
925
|
+
return await withConfigLockAsync$1(() => clearSupervisor(root, expected));
|
|
926
|
+
} catch (error) {
|
|
927
|
+
const message = `Could not clear workspace registration: ${error instanceof Error ? error.message : String(error)}`;
|
|
928
|
+
report(chalk.red(phaseLine("stop", message)));
|
|
929
|
+
return { error: message };
|
|
911
930
|
}
|
|
912
931
|
}
|
|
913
932
|
const INTERRUPT_WAIT_MS = 6e4;
|
|
@@ -951,22 +970,30 @@ function workspaceDeviceSlots(root) {
|
|
|
951
970
|
if (typeof readRemoteSession(root)?.sessionId === "string" && !slots.includes("default")) slots.push("default");
|
|
952
971
|
return slots;
|
|
953
972
|
}
|
|
954
|
-
function readRemoteSessionEntry(root, report) {
|
|
973
|
+
async function readRemoteSessionEntry(root, report, operation) {
|
|
955
974
|
const sessionId = readRemoteSession(root)?.sessionId;
|
|
956
975
|
if (typeof sessionId !== "string") return null;
|
|
957
976
|
report(chalk.dim(phaseLine("device", `ending remote session ${sessionId} without waiting on the build lock`)));
|
|
958
977
|
return endRemoteSession(root, sessionId, {
|
|
959
|
-
teardownRemoteSession: defaultTeardownRemoteSession,
|
|
978
|
+
teardownRemoteSession: (projectRoot, id) => defaultTeardownRemoteSession(projectRoot, id, operation),
|
|
960
979
|
report
|
|
961
980
|
});
|
|
962
981
|
}
|
|
982
|
+
function signalledHolder(holder) {
|
|
983
|
+
return nativeRunHolder(holder).takesSignals && holder.owner.pid !== process.pid;
|
|
984
|
+
}
|
|
963
985
|
/**
|
|
964
986
|
* `stop` under the workspace's native-run lock. A billable remote session is ended as soon as the lock is
|
|
965
|
-
* seen held; a live `ios` or `android` run that the stop leaves nothing to deploy to is
|
|
966
|
-
* SIGINT and given INTERRUPT_WAIT_MS to exit; a build
|
|
987
|
+
* seen held; a live `ios` or `android` run that the stop leaves nothing to deploy to is asked to cancel through
|
|
988
|
+
* its workspace state, sent SIGINT when its holder is a CLI process, and given INTERRUPT_WAIT_MS to exit; a build
|
|
989
|
+
* for another slot that stays is left running while
|
|
967
990
|
* the slot stops without the lock; any other holder is waited on with a visible notice.
|
|
968
991
|
*/
|
|
969
|
-
async function stopWorkspaceNow({ root, slot, report = (line) => console.error(line), now = Date.now, sleep, waitMs = NATIVE_RUN_WAIT_MS, interruptWaitMs = INTERRUPT_WAIT_MS, inspectIdentity = process_identity_exports.inspectProcessIdentity, interrupt = (pid) => process.kill(pid, "SIGINT"), endRemote = (projectRoot) => readRemoteSessionEntry(projectRoot, report), deviceSlots = workspaceDeviceSlots, recordedSlots = recordedDeviceSlots, stop = (options) => runStop(
|
|
992
|
+
async function stopWorkspaceNow({ root, operation, slot, report = (line) => console.error(line), now = Date.now, sleep, waitMs = NATIVE_RUN_WAIT_MS, interruptWaitMs = INTERRUPT_WAIT_MS, inspectIdentity = process_identity_exports.inspectProcessIdentity, interrupt = (pid) => process.kill(pid, "SIGINT"), endRemote = (projectRoot) => readRemoteSessionEntry(projectRoot, report, operation), deviceSlots = workspaceDeviceSlots, recordedSlots = recordedDeviceSlots, stop = (options) => runStop({
|
|
993
|
+
...options,
|
|
994
|
+
operation,
|
|
995
|
+
report
|
|
996
|
+
}) }) {
|
|
970
997
|
if (slot === "web") return stop({
|
|
971
998
|
root,
|
|
972
999
|
slot
|
|
@@ -983,10 +1010,10 @@ async function stopWorkspaceNow({ root, slot, report = (line) => console.error(l
|
|
|
983
1010
|
};
|
|
984
1011
|
let remote = null;
|
|
985
1012
|
let remoteHandled = slot !== void 0;
|
|
986
|
-
const endRemoteNow = () => {
|
|
1013
|
+
const endRemoteNow = async () => {
|
|
987
1014
|
if (remoteHandled) return;
|
|
988
1015
|
remoteHandled = true;
|
|
989
|
-
remote = endRemote(root);
|
|
1016
|
+
remote = await endRemote(root);
|
|
990
1017
|
};
|
|
991
1018
|
const notice = nativeRunWaitNotice({
|
|
992
1019
|
write: (line) => report(chalk.dim(phaseLine("lock", line))),
|
|
@@ -994,62 +1021,71 @@ async function stopWorkspaceNow({ root, slot, report = (line) => console.error(l
|
|
|
994
1021
|
});
|
|
995
1022
|
let seen = null;
|
|
996
1023
|
const interrupted = [];
|
|
997
|
-
const onHeld = (holder) => {
|
|
1024
|
+
const onHeld = async (holder) => {
|
|
998
1025
|
const at = now();
|
|
999
1026
|
if (seen?.claimId === holder.claimId) {
|
|
1000
1027
|
if (seen.action === "interrupt" && at >= seen.deadline) {
|
|
1001
1028
|
if (inspectIdentity(holder.owner) !== "same") throw ownerGoneRefusal(holder, at);
|
|
1029
|
+
const signalled = signalledHolder(holder);
|
|
1002
1030
|
throw new StopBlocked({
|
|
1003
1031
|
code: "STIM_STOP_BLOCKED",
|
|
1004
|
-
message: `${describeNativeRunHolder(holder, at)} did not exit within ${Math.round(interruptWaitMs / 1e3)}s of SIGINT; it still holds this workspace's native-run claim at ${holder.path}.`,
|
|
1005
|
-
remedy: `Wait for it to finish, or end it with \`kill ${holder.owner.pid}\`, then run \`stim stop\` again.`
|
|
1032
|
+
message: `${describeNativeRunHolder(holder, at)} did not exit within ${Math.round(interruptWaitMs / 1e3)}s of ${signalled ? "SIGINT" : "the stop request"}; it still holds this workspace's native-run claim at ${holder.path}.`,
|
|
1033
|
+
remedy: signalled ? `Wait for it to finish, or end it with \`kill ${holder.owner.pid}\`, then run \`stim stop\` again.` : `It runs inside process ${holder.owner.pid}, which embeds Stim (such as stim-server) and runs other work too. Wait for the run to finish, or cancel it from the client that started it, then run \`stim stop\` again.`
|
|
1006
1034
|
});
|
|
1007
1035
|
}
|
|
1008
1036
|
notice(holder);
|
|
1009
1037
|
return;
|
|
1010
1038
|
}
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
seen = {
|
|
1025
|
-
claimId: holder.claimId,
|
|
1026
|
-
action,
|
|
1027
|
-
deadline: Number.POSITIVE_INFINITY
|
|
1028
|
-
};
|
|
1029
|
-
const who = describeNativeRunHolder(holder, at);
|
|
1030
|
-
if (action === "proceed") {
|
|
1031
|
-
notice(holder, `leaving ${who} running: slot ${target.slot} stays, so slot ${slot} stops without the build lock`);
|
|
1032
|
-
throw new LeaveBuildRunning();
|
|
1033
|
-
}
|
|
1034
|
-
if (action === "refuse") throw ownerGoneRefusal(holder, at);
|
|
1035
|
-
if (action === "interrupt") {
|
|
1036
|
-
requestNativeRunCancel(root, holder.claimId);
|
|
1037
|
-
interrupted.push(holder.claimId);
|
|
1039
|
+
try {
|
|
1040
|
+
const target = nativeRunHolder(holder);
|
|
1041
|
+
if (unknownSlot) {
|
|
1042
|
+
const refusal = target.slot === slot ? null : stillUnknown();
|
|
1043
|
+
if (refusal) throw refusal;
|
|
1044
|
+
unknownSlot = false;
|
|
1045
|
+
}
|
|
1046
|
+
const { action } = decideStopAction({
|
|
1047
|
+
stopSlot: slot,
|
|
1048
|
+
holder: target,
|
|
1049
|
+
ownerIdentity: inspectIdentity(holder.owner),
|
|
1050
|
+
deviceSlots: deviceSlots(root)
|
|
1051
|
+
});
|
|
1038
1052
|
seen = {
|
|
1039
1053
|
claimId: holder.claimId,
|
|
1040
1054
|
action,
|
|
1041
|
-
deadline:
|
|
1055
|
+
deadline: Number.POSITIVE_INFINITY
|
|
1042
1056
|
};
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
if (error?.code !== "ESRCH") throw error;
|
|
1057
|
+
const who = describeNativeRunHolder(holder, at);
|
|
1058
|
+
if (action === "proceed") {
|
|
1059
|
+
notice(holder, `leaving ${who} running: slot ${target.slot} stays, so slot ${slot} stops without the build lock`);
|
|
1060
|
+
throw new LeaveBuildRunning();
|
|
1048
1061
|
}
|
|
1049
|
-
|
|
1050
|
-
|
|
1062
|
+
if (action === "refuse") throw ownerGoneRefusal(holder, at);
|
|
1063
|
+
if (action === "interrupt") {
|
|
1064
|
+
await withWorkspaceStateLockAsync(root, () => requestNativeRunCancel(root, holder.claimId));
|
|
1065
|
+
interrupted.push(holder.claimId);
|
|
1066
|
+
seen = {
|
|
1067
|
+
claimId: holder.claimId,
|
|
1068
|
+
action,
|
|
1069
|
+
deadline: now() + interruptWaitMs
|
|
1070
|
+
};
|
|
1071
|
+
if (inspectIdentity(holder.owner) !== "same") return;
|
|
1072
|
+
const wait = `waiting up to ${Math.round(interruptWaitMs / 1e3)}s for it to exit`;
|
|
1073
|
+
if (!signalledHolder(holder)) {
|
|
1074
|
+
notice(holder, `interrupting ${who}: asked it to stop, ${wait}`);
|
|
1075
|
+
return;
|
|
1076
|
+
}
|
|
1077
|
+
try {
|
|
1078
|
+
interrupt(holder.owner.pid);
|
|
1079
|
+
} catch (error) {
|
|
1080
|
+
if (error?.code !== "ESRCH") throw error;
|
|
1081
|
+
}
|
|
1082
|
+
notice(holder, `interrupting ${who}: sent SIGINT, ${wait}`);
|
|
1083
|
+
return;
|
|
1084
|
+
}
|
|
1085
|
+
notice(holder);
|
|
1086
|
+
} finally {
|
|
1087
|
+
await endRemoteNow();
|
|
1051
1088
|
}
|
|
1052
|
-
notice(holder);
|
|
1053
1089
|
};
|
|
1054
1090
|
const withRemote = (result) => {
|
|
1055
1091
|
if (!remote || result.outcomes.device.remote) return result;
|
|
@@ -1067,9 +1103,11 @@ async function stopWorkspaceNow({ root, slot, report = (line) => console.error(l
|
|
|
1067
1103
|
});
|
|
1068
1104
|
}, {
|
|
1069
1105
|
external: true,
|
|
1106
|
+
signal: operation?.signal,
|
|
1070
1107
|
waitMs,
|
|
1071
1108
|
now,
|
|
1072
1109
|
...sleep ? { sleep } : {},
|
|
1110
|
+
declareSpawnsFor: operation,
|
|
1073
1111
|
details: {
|
|
1074
1112
|
command: "stop",
|
|
1075
1113
|
...slot === void 0 ? {} : { slot }
|
|
@@ -1085,10 +1123,12 @@ async function stopWorkspaceNow({ root, slot, report = (line) => console.error(l
|
|
|
1085
1123
|
refusal: error.refusal,
|
|
1086
1124
|
remote
|
|
1087
1125
|
};
|
|
1088
|
-
if ((0, ownership_claim_exports.isClaimRefusal)(error)) endRemoteNow();
|
|
1126
|
+
if ((0, ownership_claim_exports.isClaimRefusal)(error)) await endRemoteNow();
|
|
1089
1127
|
throw error;
|
|
1090
1128
|
} finally {
|
|
1091
|
-
for (const claimId of interrupted)
|
|
1129
|
+
for (const claimId of interrupted) try {
|
|
1130
|
+
await withWorkspaceStateLockAsync(root, () => clearNativeRunCancel(root, claimId));
|
|
1131
|
+
} catch {}
|
|
1092
1132
|
}
|
|
1093
1133
|
}
|
|
1094
1134
|
function stopCommand(program) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { f as ownership_claim_exports, p as process_identity_exports } from "./exec-_UbtCQcG.mjs";
|
|
2
|
+
import { d as workspaceDir } from "./paths-DQtTgsBf.mjs";
|
|
3
|
+
import { d as writeWorkspaceState, l as withWorkspaceStateLockAsync } from "./workspace-state-Cjuigeeu.mjs";
|
|
4
|
+
import { a as macosRuntimeClaim, o as requiredMacosRecord } from "./state-XMziexv2.mjs";
|
|
5
|
+
import { S as runningBundleInstancesAsync } from "./workspaces-BccMFmGQ.mjs";
|
|
6
|
+
import { t as withWorkspaceProcessLock } from "./workspace-process-lock-1_1OoVW5.mjs";
|
|
7
|
+
import { n as stopHostedMacos } from "./hosted-macos-QI141yKk.mjs";
|
|
7
8
|
import { readMacosRecord } from "@stim-cli/core/state";
|
|
8
9
|
//#region src/macos/stop.ts
|
|
9
10
|
const APP_EXIT_MS = 5e3;
|
|
@@ -33,7 +34,7 @@ async function stopProcesses(records, waitMs = APP_EXIT_MS) {
|
|
|
33
34
|
}
|
|
34
35
|
/** Stops every running copy of the workspace's owned app bundle, including copies LaunchServices started. */
|
|
35
36
|
async function stopBundleInstances(root) {
|
|
36
|
-
const instances =
|
|
37
|
+
const instances = await runningBundleInstancesAsync(root);
|
|
37
38
|
await stopProcesses(instances);
|
|
38
39
|
return instances.length > 0;
|
|
39
40
|
}
|
|
@@ -42,7 +43,7 @@ async function stopMacosAppHeld(root) {
|
|
|
42
43
|
if (record?.supervisor) await stopProcesses([record.supervisor], SUPERVISOR_EXIT_MS);
|
|
43
44
|
const app = readMacosRecord(root)?.app ?? record?.app;
|
|
44
45
|
if (app) await stopProcesses([app]);
|
|
45
|
-
const instances =
|
|
46
|
+
const instances = await runningBundleInstancesAsync(root);
|
|
46
47
|
await stopProcesses(instances);
|
|
47
48
|
if (!record) return instances.length > 0;
|
|
48
49
|
const claims = (0, ownership_claim_exports.readClaimSet)(macosRuntimeClaim(root));
|
|
@@ -56,10 +57,10 @@ function stopMacosApp(root) {
|
|
|
56
57
|
if (!record?.host) return stopMacosAppHeld(root);
|
|
57
58
|
await stopHostedMacos(root, record.host);
|
|
58
59
|
const { host: _host, hostLaunched: _launched, ...stopped } = record;
|
|
59
|
-
writeWorkspaceState(root, { macos: {
|
|
60
|
+
await withWorkspaceStateLockAsync(root, () => writeWorkspaceState(root, { macos: {
|
|
60
61
|
...stopped,
|
|
61
62
|
supervisor: void 0
|
|
62
|
-
} });
|
|
63
|
+
} }));
|
|
63
64
|
return true;
|
|
64
65
|
};
|
|
65
66
|
return withWorkspaceProcessLock(workspaceDir(root), "macos-launch", stop, {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { a as clearExpoMetroTunnel, c as writePidFile, n as MODE_BARE, o as clearWorkspaceSupervisor, r as MODE_EXPO, s as readPidFile, t as SettingsObject } from "./settings-DkdmlelE.mjs";
|
|
2
|
+
import { n as NdjsonWriter } from "./exec-H20xSg2T.mjs";
|
|
3
|
+
import { n as OwnedDeviceActivity } from "./idle-BVeRGroT.mjs";
|
|
4
|
+
import { DevServerStopRecord, DeviceIdleShutdownRecord } from "@stim-cli/core/state";
|
|
5
|
+
//#region src/watchman.d.ts
|
|
6
|
+
type WatchmanCommand = (args: string[], timeoutMs: number) => Promise<unknown>;
|
|
7
|
+
//#endregion
|
|
4
8
|
//#region src/supervisor/types.d.ts
|
|
5
9
|
interface ServerExitInfo {
|
|
6
10
|
code?: number | null;
|
|
@@ -30,16 +34,6 @@ interface IdleProbe {
|
|
|
30
34
|
blocker(): string | null;
|
|
31
35
|
}
|
|
32
36
|
//#endregion
|
|
33
|
-
//#region src/commands/gc/idle.d.ts
|
|
34
|
-
interface OwnedDeviceActivity {
|
|
35
|
-
kind: "ios" | "android";
|
|
36
|
-
id: string;
|
|
37
|
-
name: string;
|
|
38
|
-
project: string;
|
|
39
|
-
slot: string;
|
|
40
|
-
activity: DeviceActivity;
|
|
41
|
-
}
|
|
42
|
-
//#endregion
|
|
43
37
|
//#region src/devices/idle-shutdown.d.ts
|
|
44
38
|
interface DueDevice {
|
|
45
39
|
device: OwnedDeviceActivity;
|
|
@@ -60,10 +54,7 @@ interface IdleShutdownEvent {
|
|
|
60
54
|
declare function shutDownIdleDevices(root: string, idleMs: number, log: (event: IdleShutdownEvent) => void, now?: number, { only, reason }?: {
|
|
61
55
|
only?: OwnedDeviceActivity;
|
|
62
56
|
reason?: DeviceIdleShutdownRecord["reason"];
|
|
63
|
-
}): number
|
|
64
|
-
//#endregion
|
|
65
|
-
//#region src/watchman.d.ts
|
|
66
|
-
type WatchmanCommand = (args: string[], timeoutMs: number) => Promise<unknown>;
|
|
57
|
+
}): Promise<number>;
|
|
67
58
|
//#endregion
|
|
68
59
|
//#region src/supervisor/run.d.ts
|
|
69
60
|
interface ParsedSupervisorArgs {
|