....this is an odd bug.
swift-build-tool returns error code 127 when it happens to be invoked via NSTask.
An identical invocation that isn't via NSTask works fine. ...I am as puzzled as you.
To assist with reproducing this issue, I've created a portable Docker image that exactly matches my environment. Reproduction steps:
1. Extract the files to some directory
2. docker build .
Expected results: Container builds
Actual results: Docker container fails to build
1. The docker container tries to invoke launch.swift
2. launch.swift creates an NSTask that calls swift-build-tool
3. swift-build-tool returns error code 127 to launch.swift
4. launch.swift hits fatalError codepath
If you instead invoke swift-build-tool in exactly the same way without NSTask, everything's fine:
1. Maybe corelibs-Foundation is doing something strange?
2. could swift-build-tool be expecting a tty / stdin / stdout?