Leif Leif - 4 months ago 23
Node.js Question

Can you spawn a child process written in a different language than a Python or PHP server, like you would with Node.js?

What are the Python (Tornado/Flask/etc) or Apache/PHP ways of spawning a child process to run a script written in a different programming language than Python or PHP, and communicate with the server over standard input and output?

I'm looking for the Python/PHP equivalent to Node.js "child_process" library. I'm a Node.js programmer trying to justify using it on our company's infrastructure, and one major perk for our industry (research science) is that I would be able to use scripts written in Python and R seamlessly with a Node.js server. Before I claim that we NEED Node.js to have this benefit I want to make sure you can't do the same with a Python or PHP based server.

I'm not quite sure how to search for this


The language of the spawning process isn't relevant to the language of the spawned process. This is not a feature of Node.JS, PHP, or Python, this is a feature of the operating system.

In python, for example, one uses calls from the subprocess module. Here is an example of a Python script calling a C program:

files = subprocess.check_output(['/bin/ls', '/tmp'])