Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Go

Idiom #111 Launch other program

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

import "os/exec"
err := exec.Command("x", "a", "b").Run()

x's output is ignored.
To access it, see (*Cmd).Output, (*Cmd).StdoutPipe, etc.
#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