Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

macOS: open can start a second copy of an app that was just launched

Đang mở
#3,406 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
cli, mobile-dev

Hướng nghiên cứu

Start by tracing the macOS open command and its helper that selects an NSRunningApplication; the issue does not name their file paths or tests. Reproduce the quick relaunch case, then inspect how the command launches by bundle ID and how the helper chooses a process. Done means an already running app can be targeted without starting a duplicate or confusing two copies with the same bundle ID.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug ready-for-agent

Summary

On macOS, agent-device open <bundleId> --platform macos can start a second copy of an app that is already running, then drive whichever copy NSRunningApplication.runningApplications(withBundleIdentifier:).first returns.

Repro

  1. Launch an app yourself (e.g. a dev build started by a supervisor process with custom launch arguments).
  2. Within ~0.5–0.75 s, run agent-device open <bundleId> --platform macos.
  3. ps shows two processes for the bundle: the original (with its arguments) and a new one with ppid 1 and no arguments.

Cause: open runs /usr/bin/open [-g] -b <bundleId> without first checking for a running instance. A process that was just spawned isn't listed by LaunchServices yet (lsappinfo lists it ~0.5–0.75 s later), so open -b launches a new copy. If you wait until lsappinfo find bundleid=<id> pid=<pid> returns the process, open attaches and only one copy remains (3/3 runs).

Proposal

  • Before calling open -b, check for a running instance of the bundle (NSRunningApplication or lsappinfo) and attach to it instead of launching.
  • Offer an explicit target, e.g. --pid <pid> or an app path, so a caller that launched the app itself can attach to that exact process.
  • In the macOS helper, resolve the target by pid when one is known, rather than .first, so two copies with the same bundle id can't be confused.

Context: Stim's stim macos launches dev builds this way; we're adding a LaunchServices wait on our side, but the attach behavior would make open safe for any caller.

Ngôn ngữ chính
TypeScript
Star
5k
Fork
334
Merge trung bình
12 giờ 29 phút
Pull request đã merge (30 ngày)
663

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của callstack/agent-device

Tất cả issue của callstack/agent-device

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.