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

Idiom #111 Launch other program

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

#include <stdlib.h>
int system("x a b");
using System.Diagnostics;
string[] args = { "a", "b"};
Process.Start(x, string.Join(" ", args));
import std.process;
spawnProcess([x, "a", "b"]);
program p
   integer :: i

   call execute_command_line("x a b", exitstat=i)
   print *, "Exit status of x was ", i

   call execute_command_line("x a b", wait=.false.)
   print *, "running x in the background"
end program p 
import "os/exec"
err := exec.Command("x", "a", "b").Run()
import System.Process
spawnProcess x ["a","b"]
const { exec } = require('child_process');
exec(`${x} a b`);
exec($x . " a b");
uses process;
  p: tprocess;
  p.Executable := 'program_x';
system $x, 'a', 'b';
import subprocess['x', 'a', 'b'])
`x a b`
use std::process::Command;
let output = Command::new("x")
    .args(&["a", "b"])
    .expect("failed to execute process");

Do you know the best way to do this in your language ?
New implementation...

Idiom created by