For this "strong" problem, you need to approach it as follows:
- Is there a decent way to start processes with arguments in my language / framework
- Is there a decent way to handle output programs?
From experience, a decent way to handle arguments in a process is to pass them as an (string) array. This is advantageous in that you do not need to resort to unnecessary string interpolation and manipulation. It is also more readable, which is a plus in this task.
A decent way to process the output is to use a model based on listeners / events. This way you respond appropriately to events, not blocks for stderr and stdout. Again, this makes reading understandable and allows you to process the output in a more convenient way.
If you delve deeper into this, you will also have to solve the problem of how to embed environment variables in the target program . For example, you can run java with a debugger or with less memory in the future, so your solution would also have to satisfy this.
This is just one way to solve this problem . If node is your platform, take a look at Child Process , which supports all of these methods.
Shiraaz.M
source share