Uploaded image for project: 'Swift'
  1. Swift
  2. SR-13806

Incorrect I/O on Windows when using swift run

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: Package Manager
    • Labels:
    • Environment:

      29/10 snapshot on Windows

      Description

      When I run a Swift package with swift run, the I/O behaves weird. There can be shell prompts mixed in with the output, the input is sometimes parsed by the shell and not sent to the application, and the cursor can jump to different positions on the screen.

      Here is a sample main.swift you can try:

      func readBool(question: String) -> Bool {
          var answer: String
          repeat {
              print("\(question) (y/n): ", terminator: "")
              answer = readLine()!
          } while answer != "y" && answer != "n"
          return answer == "y"
      }
      
      while readBool(question: "Do you feel lucky? �") { }
      

      Note that the application behaves correctly when I run the executable directly. It is only when I use swift run that I see these issues.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            svanimpe Steven Van Impe
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: