Skip to content

Commit 2411777

Browse files
committed
handle empty package file
1 parent 4499312 commit 2411777

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Sources/ManifestParser/Manifest+parse.swift

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,26 +62,23 @@ private func parse(manifestPath: String) throws -> String? {
6262
var cmd = [Resources.path.swiftc]
6363
cmd += ["--driver-mode=swift"]
6464
cmd += ["-I", libdir]
65-
cmd += ["-L", libdir, "-lPackageDescription", "-llibc", "-lPOSIX"]
65+
cmd += ["-L", libdir, "-lPackageDescription"]
6666
#if os(OSX)
6767
cmd += ["-target", "x86_64-apple-macosx10.10"]
6868
#endif
6969
cmd += [manifestPath]
7070

7171
//Create and open a temporary file to write toml to
7272
let filePath = Path.join(manifestPath.parentDirectory, ".Package.toml")
73-
print("PATH: \(filePath)")
7473
let fp = try fopen(filePath, mode: .Write)
7574
defer { fclose(fp) }
7675

7776
//Pass the fd in arguments
7877
cmd += ["-fileno", "\(fileno(fp))"]
7978
try system(cmd)
8079

81-
fclose(fp)
82-
8380
let toml = try File(path: filePath).enumerate().reduce("") { $0 + "\n" + $1 }
8481
unlink(filePath) //Delete the temp file after reading it
8582

86-
return toml
83+
return toml != "" ? toml : nil
8784
}

0 commit comments

Comments
 (0)