Skip to content

Commit

Permalink
Merge pull request #17 from p-x9/version/0.3.0
Browse files Browse the repository at this point in the history
Version 0.3.0
  • Loading branch information
p-x9 authored Aug 25, 2023
2 parents 83f03f9 + 45741ea commit 5732e35
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ let package = Package(
),
.binaryTarget(
name: "run-script-bin",
url: "https://github.com/p-x9/RunScriptPlugin/releases/download/0.1.0/run-script-bin.artifactbundle.zip",
checksum: "d5e984321b277ca3228f2d1d2e4eb0f84f6ff53e05d0516a0640838aa60e32c5"
url: "https://github.com/p-x9/RunScriptPlugin/releases/download/0.3.0/run-script-bin.artifactbundle.zip",
checksum: "3e43154c72e5d7bdadbe000cd23f78cbcf8f200149ea28a969539c22ef7be524"
),
// DEBUG
// .binaryTarget(name: "run-script-bin", path: "./run-script-bin.artifactbundle.zip"),
Expand Down
10 changes: 8 additions & 2 deletions Sources/run-script/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ extension RunScript {
extension RunScript {
func run(_ script: Script) throws {
let process = Process()
let errorPipe = Pipe()

process.launchPath = script.launchPath ?? "/bin/sh"
process.standardError = errorPipe

if let path = script.path {
process.arguments = [path]
Expand All @@ -96,8 +98,12 @@ extension RunScript {
process.arguments = ["-c", script]
}

process.launch()
process.waitUntilExit()
try process.run()

let errorData = errorPipe.fileHandleForReading.readDataToEndOfFile()
if let error = String(data: errorData, encoding: .utf8) {
log("warning: [RunScriptPlugin] " + error)
}
}
}

Expand Down

0 comments on commit 5732e35

Please sign in to comment.