Logo

Programming-Idioms

New implementation

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating resource.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
#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`);
os.execute(x .. 'a b')
exec($x . " a b");
uses process;
var
  p: tprocess;
begin
  p.Executable := 'program_x';
  p.Parameters.Add('a');
  p.Parameters.Add('b');
  p.Execute;
end.
system $x, 'a', 'b';
import subprocess
subprocess.call(['x', 'a', 'b'])
`x a b`
use std::process::Command;
let output = Command::new("x")
    .args(&["a", "b"])
    .spawn()
    .expect("failed to execute process");
use std::process::Command;
let output = Command::new("x")
        .args(&["a", "b"])
        .output()
        .expect("failed to execute process");