Skip to content

REPL scrubs important environment variables #70005

Open
@compnerd

Description

@compnerd

Description
The REPL scrubs TMP, TEMP, and USERPROFILE from the environment when it launches. This is problematic for Windows as these are important to certain API usage.

Steps to reproduce

swift repl
1> import Foundation
2> try "contents".write(toFile: "file.txt", atomically: true, encoding: .ascii)

Expected behavior
I expect this to be successful. However, this requires that the environment variables be set so that the Win32 APIs for computing the temporary directory function properly.

Environment

  • Swift compiler version info:

Swift version 5.11-dev (LLVM fe9a485647a386d, Swift 104d19bca0ea745)
Target: x86_64-unknown-windows-msvc

  • Xcode version info:
  • Deployment target: Windows 11 22H2

Metadata

Metadata

Assignees

No one assigned

    Labels

    REPLWindowsPlatform: WindowsbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.swift 6.0swift 6.1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions