Skip to content

Display the process ID in the when running a Swift PM command that has a hold of the .build directory #8528

@bkhouri

Description

@bkhouri

Description

As a software developer using Swift Package Manager, I would like the "lock message" to contain the Process ID that is locking a Swift PM action so that I can inspect the process and make an informed decision if I want to terminate it or let it run to completion.

Expected behavior

Swift PM has knowledge that another instance is currently using the .build directory. It would be ideal to include the process ID of that instance in the message

❯ swift build --disable-prefetching
Another instance of SwiftPM is already running using '/Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager/.build', waiting until that process has finished execution...

Actual behavior

maybe something line

❯ swift build --disable-prefetching
Another instance of SwiftPM (pID ######) is already running using '/Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager/.build', waiting until that process has finished execution...

Steps to reproduce

  1. Open a terminal, and run swift test --no-parallel (ensuring the build takes "time")
  2. While the first command is running, in another terminal, execute swift test --no-parallel

Swift Package Manager version/commit hash

Swift Package Manager - Swift 6.1.0

Swift & OS version (output of swift --version && uname -a)

❯ uname -a
Darwin BKs-Work-M1Pro-MacBook-Pro-3.local 24.5.0 Darwin Kernel Version 24.5.0: Sun Apr 13 22:01:22 PDT 2025; root:xnu_development-11417.120.105.0.2~26/DEVELOPMENT_ARM64_T6000 arm64

❯ swift --version
Apple Swift version 6.1 (swift-6.1-RELEASE)
Target: arm64-apple-macosx15.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions