Skip to content

Commit

Permalink
Use SourceKittenFramework's service names for SourceKit process searc…
Browse files Browse the repository at this point in the history
…hing

Also fixed some spelling errors.
  • Loading branch information
neakor committed Nov 5, 2018
1 parent 173b897 commit 083be8f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Generator/Sources/NeedleFramework/Needle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class Needle {
let exporter = DependencyGraphExporter()
try exporter.export(components, with: imports + additionalImports, to: destinationPath, using: executor, include: headerDocPath)
} catch DependencyGraphParserError.timeout(let sourcePath, let taskId, let isSourceKitRunning) {
fatalError("Parsing Swift source file at \(sourcePath) timed out when executing task with ID \(taskId). SourceKit deamon process status: \(isSourceKitRunning).")
fatalError("Parsing Swift source file at \(sourcePath) timed out when executing task with ID \(taskId). SourceKit daemon process status: \(isSourceKitRunning).")
} catch DependencyGraphExporterError.timeout(let componentName) {
fatalError("Generating dependency provider for \(componentName) timed out.")
} catch DependencyGraphExporterError.unableToWriteFile(let outputFile) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class PluginizedNeedle {
let exporter = PluginizedDependencyGraphExporter()
try exporter.export(components, pluginizedComponents, with: imports + additionalImports, to: destinationPath, using: executor, include: headerDocPath)
} catch DependencyGraphParserError.timeout(let sourcePath, let taskId, let isSourceKitRunning) {
fatalError("Parsing Swift source file at \(sourcePath) timed out when executing task with ID \(taskId). SourceKit deamon process status: \(isSourceKitRunning).")
fatalError("Parsing Swift source file at \(sourcePath) timed out when executing task with ID \(taskId). SourceKit daemon process status: \(isSourceKitRunning).")
} catch DependencyGraphExporterError.timeout(let componentName) {
fatalError("Generating dependency provider for \(componentName) timed out.")
} catch DependencyGraphExporterError.unableToWriteFile(let outputFile) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@

import Foundation

/// Check if the sourcekit deamon process is running by searching through
/// Check if the sourcekit daemon process is running by searching through
/// all processes without ttys.
var isSourceKitRunning: Bool {
// Select processes without controlling ttys in jobs format.
let result = ProcessUtilities.execute(process: "/bin/ps", withArguments: ["-xj"])
return result.lowercased().contains("sourcekit")
let result = ProcessUtilities.execute(process: "/bin/ps", withArguments: ["-xj"]).lowercased()
// These process names are found in library_wrapper_sourcekitd.swift
// of SourceKittenFramework.
return result.contains("libsourcekitdInProc") || result.contains("sourcekitd.framework")
}

/// A set of utility functions for running processes.
Expand Down

0 comments on commit 083be8f

Please sign in to comment.