view toys/other/setsid.c @ 1539:3e85af1f7e22 draft

First batch of sed tests. Only good for TEST_HOST=1 at the moment because the test infrastructure itself depends on sed, so if an unfinished sed is in the $PATH it goes boing. But hey, corner cases! I have... more.
author Rob Landley <>
date Wed, 29 Oct 2014 18:44:33 -0500
parents 144d5ba7d410
children cbb1aca81eca
line wrap: on
line source

/* setsid.c - Run program in a new session ID.
 * Copyright 2006 Rob Landley <>


config SETSID
  bool "setsid"
  default y
    usage: setsid [-t] command [args...]

    Run process in a new session.

    -t	Grab tty (become foreground process, receiving keyboard signals)

#include "toys.h"

void setsid_main(void)
  while (setsid()<0) if (vfork()) _exit(0);
  if (toys.optflags) {
    tcsetpgrp(0, getpid());