3 ms·
Here's an example you can try on any Linux System running procfs. https://gist.github.com/amorphid/4a65741d14db38b96341d7e1f2dd69b6 https://gist.github.com/amo
by amorphid 10y ago
Here's an example you can try on any Linux System running procfs.
https://gist.github.com/amorphid/4a65741d14db38b96341d7e1f2dd69b6 https://gist.github.com/amorphid/4a65741d14db38b96341d7e1f2d...
The short version is I'm passing a variable in via the pid's standard in, reading the line, and then declaring the variable. This is a very contrived example :) But you can write a wrapper script that would handle all of the line reading for you.
This originally came up when I was asking someone how to pass sensitive information (API keys, passwords, etc.). I did some research, and found this approach.
In most programming languages, for basic system calls, you basically just call a command, that command runs, and then exits. But sometimes you want a script that can take information from standard in, or send it to you from standard out. Like you may write a script that runs for a few minutes, then says "OK, I'm ready for the password!", and then you pass it in at the time it's needed (but honestly, don't do it unless you need to, because it's one more thing that can break.
Erlang/Elixir land have a library called erlexec that does this => http://saleyn.github.io/erlexec/ http://saleyn.github.io/erlexec/
Another Elixir library is Porcelain => https://github.com/alco/porcelain https://github.com/alco/porcelain