Logo

Programming-Idioms

  • C++
  • Haskell
  • Python

Idiom #111 Launch other program

From current process, run program x with command-line parameters "a", "b".

import subprocess
subprocess.call(['x', 'a', 'b'])
import System.Process
spawnProcess x ["a","b"]

Assuming that x is a filepath to the program to run.
#include <stdlib.h>
int system("x a b");

This spawns a shell and returns, when the child process has exited.

New implementation...
< >
programming-idioms.org