This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-06-22
Channels
- # beginners (8)
- # boot (41)
- # cider (1)
- # cljsrn (2)
- # clojure (91)
- # clojure-dev (34)
- # clojure-gamedev (3)
- # clojure-germany (6)
- # clojure-greece (324)
- # clojure-japan (2)
- # clojure-miami (4)
- # clojure-nl (6)
- # clojure-quebec (3)
- # clojure-russia (26)
- # clojure-spec (50)
- # clojure-uk (19)
- # clojurescript (147)
- # core-async (5)
- # css (2)
- # cursive (15)
- # datascript (7)
- # datomic (6)
- # hoplon (1)
- # jobs (4)
- # lein-figwheel (17)
- # off-topic (4)
- # om (52)
- # om-next (10)
- # onyx (1)
- # planck (19)
- # proton (1)
- # re-frame (81)
- # reagent (61)
- # spacemacs (1)
- # specter (46)
- # spirituality-ethics (7)
- # untangled (7)
- # yada (17)
[a similar method (redirecting both stdout and stderr to files instead of just stderr) is demonstrated here (in the OP): http://stackoverflow.com/questions/15155314/redirect-stdout-and-stderr-to-the-same-file-and-restore-it]
@johanatan: I’ll read up on the popen
/ fork
/ pipe
business. I’ve never tried doing things things at this level before 🙂
ok, my preferred approach would be the popen()
/`freopen()` combination mentioned above [as it's the least complex to implement] (assuming you're ok with temp files).
Sounds like temp files would work, but obviously not a desired outcome if it can be avoided. (I don’t understand the APIs yet.)
If nothing else, perhaps a temp-file based approach could be implemented and then we could revisit it as we learn more.
but i will wait for you to do some research and come to some conclusions as well. perhaps there is something my research has missed
[also, i was thinking it would be nice if there were some sort of 3rd party C library out there which handles this-- i'd imagine any sort of higher-level OS abstraction library would support this sort of thing]
@johanatan: I don’t know if this leads to the ability to construct a solution, but it can evidently be done with 3 pipes. In this gist, I gave errfd
a questionable variable name (because I was confused with what I was doing), but, it seems to work: https://gist.github.com/mfikes/52332f568be9da2dd72ee9376e5b9f34
@johanatan: It is true that it is a decent amount of code to cobble together. (And there is probably some sort of select
stuff that really needs to be done.) If it is more than you’d like to take on, certainly don’t feel obligated.
yes, that's the "solution inspired by kangear" I referred to. 🙂 no, it's not too much work for me
oops, sorry. that's a different solution involving a manual fork()
and execv()
rather than popen()
. i remember running across that one too
@johanatan: Yeah… if a solution can be built using pipes rather than tmp files, I think it’s worth it, given that sh
is a pretty key feature, even if it involves a decent amount of code.