node.js -- execute command synchronously and get result
So I have a solution working, but don't exactly like it... Just posting here for reference:
I'm using the node-ffi
library referenced in the other SO post. I have a function that:
- takes in a given command
- appends
>> run-sync-output
- executes it
- reads
run-sync-output
synchronously and stores the result - deletes this tmp file
- returns result
There's an obvious issue where if the user doesn't have write access to the current directory, it will fail. Plus, it's just wasted effort. :-/