Skip to content

Commit 8502603

Browse files
authored
Merge pull request #19 from p-x9/feature/check-error-string-length
Checks if error string is empty
2 parents 62bf2dc + b131517 commit 8502603

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Sources/run-script/main.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,15 @@ extension RunScript {
9898
process.arguments = ["-c", script]
9999
}
100100

101-
try process.run()
102-
103-
let errorData = errorPipe.fileHandleForReading.readDataToEndOfFile()
104-
if let error = String(data: errorData, encoding: .utf8) {
105-
log("warning: [RunScriptPlugin] " + error)
101+
do {
102+
try process.run()
103+
process.waitUntilExit()
104+
} catch {
105+
let errorData = errorPipe.fileHandleForReading.readDataToEndOfFile()
106+
if let error = String(data: errorData, encoding: .utf8),
107+
!error.isEmpty {
108+
log("warning: [RunScriptPlugin] " + error)
109+
}
106110
}
107111
}
108112
}

0 commit comments

Comments
 (0)