swiftlang/swift-package-manager

Command Plugin invocation should inherit TTY

kateinoigakukun opened this issue · 0 comments

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

  • Confirmed reproduction steps with SwiftPM CLI.

Description

Currently isatty(stdout) in a command plugin process is always false even though the SwiftPM process itself is connected to TTY.
Attached a reproducible project: ColorizedPlugin.tar.gz

Currently, tty is detached at plugin invocation here: https://github.com/apple/swift-package-manager/blob/ad7b5ced3cf3af194c10faf4492a9b927f6222d9/Sources/Workspace/DefaultPluginScriptRunner.swift#L524-L532

As far as I understand, we don't need to detach tty for the command plugin even though it may not be the case for the buildTool plugin.

Expected behavior

isatty: 1

Actual behavior

isatty: 0

Steps to reproduce

swift package my-plugin

Swift Package Manager version/commit hash

swift-DEVELOPMENT-SNAPSHOT-2024-05-15-a

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

No response