Commit 361b47bd authored by Drew's avatar Drew

Update to Swift Preview 4

Fixes from SP3 commits for relative path calculation
parent e4524c67
Subproject commit 79f5d1dc15017965216aaf5b905c2ca142dd7125
Subproject commit 6fdd57f7daa08b9ab19fced0392aeeb3edc87d9d
......@@ -72,7 +72,7 @@ final class Shell : Tool {
environment["ATBUILD_BIN_PATH"] = binPath.description
environment["PWD"]=String(validatingUTF8: realpath(task.importedPath.description,nil))!
print("pwd set to",environment["PWD"])
print("pwd set to",environment["PWD"]!)
return environment
}
func run(task: Task) {
......
......@@ -118,8 +118,15 @@ func anarchySystem(_ cmd: String, environment: [String: String]) {
let args: [String] = ["sh","-c",cmd]
let argv = args.map{ $0.withCString(strdup) }
let env: [UnsafeMutablePointer<CChar>?] = environment.map{ "\($0.0)=\($0.1)".withCString(strdup) }
let directory = try! FS.getWorkingDirectory()
defer {try! FS.changeWorkingDirectory(path: directory)}
if let e = environment["PWD"] {
try! FS.changeWorkingDirectory(path: Path(environment["PWD"]!))
}
let status = posix_spawn(&pid, "/bin/sh",nil,nil,argv + [nil],env + [nil])
if status != 0 {
fatalError("spawn error \(status)")
}
......
//this is an error on Swift 2
//but "xcode-beta" currently ships swift 2.2
//so if we compile successfully, we used Xcode-beta compiler.
enum E : ErrorProtocol {}
\ No newline at end of file
enum E : Error {}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment