Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

“swift ./-” does the same as “swift -” #1541

Open
Frizlab opened this issue Feb 2, 2024 · 5 comments
Open

“swift ./-” does the same as “swift -” #1541

Frizlab opened this issue Feb 2, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@Frizlab
Copy link

Frizlab commented Feb 2, 2024

Description

swift ./- should try and read the file named - in the current folder. Instead it reads from stdin, just like swift -.

Reproduction

  1. Create a swift file name - in your cwd;
  2. Run swift ./-

Expected behavior

Swift should execute the file just created.

Environment

swift-driver version: 1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
Target: arm64-apple-macosx14.0

Additional information

No response

@Frizlab Frizlab added the bug Something isn't working label Feb 2, 2024
@sananthanarayan
Copy link

To solve this issue, try running swift run ./-

It works for me when I try this.

@Frizlab
Copy link
Author

Frizlab commented Feb 3, 2024

@sananthanarayan I get error: Could not find Package.swift in this directory or any of its parent directories. when doing swift run ./- (as expected…)

@sananthanarayan
Copy link

I have also tried with zero f these 2 commands, both work for me. Do they work for you?

  • swift ./-

  • swift "$(pwd)/-"

@sananthanarayan
Copy link

or with the swift run command try this modified version of that:

swift run -- ./-

@hamishknight
Copy link
Contributor

Seems like a driver issue, swift -### ./- outputs a frontend command with the path -, which the frontend then interprets as the stdin. FWIW adding -working-directory="$PWD" avoids the issue, since the driver will convert it to an absolute path.

@hamishknight hamishknight transferred this issue from apple/swift Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants