Skip to content

Implement Missing Command Line Quoting on Windows #2032

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

Merged
merged 1 commit into from
Mar 26, 2019

Conversation

gmittert
Copy link
Contributor

No description provided.

@gmittert
Copy link
Contributor Author

@compnerd

var command: [String] = [launchPath]
if let arguments = self.arguments {
command.append(contentsOf: arguments)
}
command = command.map(quoteWindowsCommandArg)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please keep the transformation of the [String] input to the final String passed to the native API, localized to a single function call? Like:

private func quoteWindowsCommandLine(_ commandLine: [String]) -> String {
    func quoteWindowsCommandArg(arg: String) -> String { /* ... */ }
    return commandLine.map(quoteWindowsCommandArg).joined(separator: " ")
}

@@ -102,6 +102,62 @@ private func processIsEqual(_ a : UnsafeRawPointer?, _ b : UnsafeRawPointer?) ->
return true
}

#if os(Windows)
private func quoteWindowsCommandArg(arg: String) -> String {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the trailing semicolons from within this function

Copy link
Contributor Author

@gmittert gmittert Mar 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oof, that's what I get for copying c++ code without thinking about it.

Copy link
Contributor

@jakepetroules jakepetroules left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@compnerd
Copy link
Member

@swift-ci please test

@gmittert
Copy link
Contributor Author

Seems like something else failed?

<unknown>:0: error: module file '/tmp/org.llvm.clang.buildnode/ModuleCache/26WBVC9BAJTXE/_Builtin_stddef_max_align_t-2M3A8EWILE044.pcm' is out of date and needs to be rebuilt: signature mismatch
08:39:23 <unknown>:0: note: imported by module 'CoreFoundation' in '/tmp/org.llvm.clang.buildnode/ModuleCache/26WBVC9BAJTXE/CoreFoundation-2V85TRDDMO0NQ.pcm'
08:39:23 swiftc: /home/buildnode/jenkins/workspace/swift-corelibs-foundation-PR-Linux/llvm/tools/clang/lib/Serialization/InMemoryModuleCache.cpp:36: llvm::MemoryBuffer &clang::InMemoryModuleCache::addBuiltPCM(llvm::StringRef, std::unique_ptr<llvm::MemoryBuffer>): Assertion `!PCM.IsFinal && "Trying to override finalized PCM?"' failed.
08:39:23 Stack dump:
08:39:23 0.	<eof> parser at end of file

@compnerd
Copy link
Member

@swift-ci please test

@compnerd compnerd merged commit fd5641d into swiftlang:master Mar 26, 2019
@gmittert gmittert deleted the FixWinCommandLine branch March 29, 2019 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants