https://github.com/honzabrecka/timeout-shell
A clojure library that works the same way as clojure.java.shell/sh does, but with ability to specify timeout.
https://github.com/honzabrecka/timeout-shell
clojure library shell
Last synced: 3 months ago
JSON representation
A clojure library that works the same way as clojure.java.shell/sh does, but with ability to specify timeout.
- Host: GitHub
- URL: https://github.com/honzabrecka/timeout-shell
- Owner: honzabrecka
- License: mit
- Created: 2016-12-21T21:49:42.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-12-21T22:17:28.000Z (about 9 years ago)
- Last Synced: 2025-02-02T01:02:05.600Z (about 1 year ago)
- Topics: clojure, library, shell
- Language: Clojure
- Homepage:
- Size: 2.93 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# timeout-shell [](https://clojars.org/timeout-shell)
A library that works the same way as [clojure.java.shell/sh](https://clojuredocs.org/clojure.java.shell/sh) does, but with ability to specify timeout.
Requires Java 1.8 as it depends on the `java.lang.Process.waitFor(long timeout, TimeUnit unit)` method internally.
## Installation
```clj
[timeout-shell "1.0.0"]
```
## Use
```clj
(require '[jx.java.shell :refer [timeout-sh]])
(timeout-sh 10 "sleep" "2")
; -> after ~2 seconds it returns {:exit 0, :out "", :err "", :timeout false}
(timeout-sh 2 "sleep" "10")
; -> after ~2 seconds it returns {:exit 1, :out "", :err "", :timeout true}
```