-
Notifications
You must be signed in to change notification settings - Fork 67
Open
Description
Steps to Reproduce
- Create a file
yolo.swiftthat contains the following content:
#!/usr/bin/env swift
print("hello")- Make it executable
- Run it like so with
swiftlyproperly installed and in thePATH:
./yolo.swift &Expected Behavior
The script should run in the background, output hello and then exit, and the shell should stay alive.
Actual Behavior
The script launches in the background, but zsh errors out reading the TTY and exits:
prompt) ./toto.swift &
[1] 64386
prompt)
zsh: error on TTY read: Input/output error
zsh: warning: 1 jobs SIGHUPed
[1] + hangup ./toto.swift
prompt)
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[Process completed]
Environment
- macOS 26.2 (25C56)
- Terminal 2.15 (466)
- zsh 5.9 (arm64-apple-darwin25.0)
- swiftly 1.1.1
- swift from Xcode:
swift-driver version: 1.127.14.1 Apple Swift version 6.2 (swiftlang-6.2.3.3.20 clang-1700.6.3.2)
Target: arm64-apple-macosx26.0
My Analysis
I’m not 100% sure that’s the problem, but I’m pretty sure the issue actually comes from swift-subprocess. I actually had this exact same issue with my own “subprocess” implementation (I really should write a Readme…).
The fix consisted in not setting the current process group ID of the input file descriptor if the process was in the background (which I determined by checking whether the current process group ID of the file descriptor is my own process group ID).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels