diff options
Diffstat (limited to 'Sources/phbar/Models/Block.swift')
| -rw-r--r-- | Sources/phbar/Models/Block.swift | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Sources/phbar/Models/Block.swift b/Sources/phbar/Models/Block.swift index 95c4ada..fe575e4 100644 --- a/Sources/phbar/Models/Block.swift +++ b/Sources/phbar/Models/Block.swift @@ -58,10 +58,14 @@ final class Block: ObservableObject, Identifiable { } /// Re-run the command and update the cells on the main actor. - func runScript() { + func runScript(env: [String: String] = [:]) { let command = self.command + + var env = env + env.updateValue(name, forKey: "BLOCK") + Task.detached(priority: .utility) { [weak self] in - let lines = Runner.run(command) + let lines = Runner.run(command, env: env) await self?.apply(lines) } } |
