Commit 1e2a7a26 authored by Drew's avatar Drew

Operate on the importedPath in the shell tool

parent 44784970
Pipeline #766 passed with stage
......@@ -27,8 +27,15 @@ import atpkg
final class Shell : Tool {
func run(task: Task) {
guard let script = task["script"]?.string else { fatalError("Invalid 'script' argument to shell tool.") }
if system("/bin/sh -c \"\(script)\"") != 0 {
fatalError("/bin/sh -c \(script)")
do {
let oldPath = NSFileManager.defaultManager().currentDirectoryPath
defer { NSFileManager.defaultManager().changeCurrentDirectoryPath(oldPath) }
NSFileManager.defaultManager().changeCurrentDirectoryPath(task.importedPath)
if system("/bin/sh -c \"\(script)\"") != 0 {
fatalError("/bin/sh -c \(script)")
}
}
}
}
\ 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