Open swift-ci opened 7 years ago
I wonder if it's specifically related to using the interpreter. (That is, does running the Xcode-built binary in the Terminal work even though running the script directly doesn't?)
Comment by Chao Gu (JIRA)
Just did some tweak to the demo, confirmed that it is not related to the interpreter (running the Xcode-built binary in terminal does not work either).
Here is what I did:
In `main.swift`, I changed the path to `subprocess.rb` an absolute path in my computer so the program can always find `subprocess.rb`
I archived the program in Xcode, then exported it.
I run the exported binary in terminal, it prompted me to "input something", then the same problem, my input wasn't accepted after I pressed `⏎`
Interesting. It looks like something is doing an extra level of buffering in Terminal that isn't happening in Xcode. I think I'll have to turn it over to the Foundation folks to figure out the difference.
(My contribution: echo hi | ./main
worked fine, as did echo hi | xcrun swift ./main.swift
.)
Environment
Apple Swift version 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1) Target: x86_64-apple-macosx10.9Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Foundation | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: fbf53e7562d6b5e0dba637f3057d795dIssue Description:
In a Swift program, I started a subprocess to run a Ruby script, in the script I expect to get some input.
It works as expected in Xcode, but does not work if I run it in terminal.
This is a demo demonstrating this: https://github.com/axl411/swift-get-input-problem