-
Notifications
You must be signed in to change notification settings - Fork 206
Handle -version argument #49
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
Conversation
@DougGregor ran into this issue when trying to use swift-driver with MovieSwiftUI |
Hmm. I think this issue with the symlinks was introduced via #25, where we reworked how tools are found, and I'm seeing it here, too. There are a few solutions:
|
4fffbeb
to
8f4dc74
Compare
@DougGregor Using |
@@ -632,6 +641,11 @@ extension Driver { | |||
|
|||
return try exec(path: tool, args: arguments) | |||
} | |||
|
|||
private func printVersion<S: OutputByteStream>(outputStream: inout S) throws { | |||
outputStream.write(try Process.checkNonZeroExit(args: swiftCompiler.pathString, "--version")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is basically in line with what we're doing today, but it reminds me that we shouldn't probably virtualize standard output / standard error for library clients. Constructing a Driver
instance that happens to print help or version information shouldn't pollute the clients standard output / standard error: they should be able to capture that output themselves. Similarly, I could imagine clients wanting to handle process execution themselves rather than having the Driver
initializer directly invoking processes. (Again, for another PR. This follows the precedent already established)
@swift-ci please test |
1 similar comment
@swift-ci please test |
Currently we have the following for getting the compiler version. The issue with this is that I'm getting into a state where
getToolPath(.swiftCompiler)
is/tmp/swift
my symlink to myswift-driver
. This is causing an infinite loop becauseswiftCompilerVersion
is called fromDriver.init
.So taking a step back:
Should
getToolPath(.swiftCompiler)
ever point to my symlink?If no, what am I doing wrong (was following the README).
If yes, then the implementation needs to change, the code below is in
Basic/Version.cpp
. Are these constants something we could have access to when building the driver? Does it even make sense for the driver to know about all these versions?