summaryrefslogtreecommitdiff
path: root/doc/s6-fghack.html
blob: 3f172efe858407f354f711607e1a10460f8115dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="Content-Language" content="en" />
    <title>s6: the s6-fghack program</title>
    <meta name="Description" content="s6: the s6-fghack program" />
    <meta name="Keywords" content="s6 command s6-fghack foreground program background hack anti-backgrounding tool" />
    <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
  </head>
<body>

<p>
<a href="index.html">s6</a><br />
<a href="//skarnet.org/software/">Software</a><br />
<a href="//skarnet.org/">skarnet.org</a>
</p>

<h1> The s6-fghack program </h1>

<p>
s6-fghack is an anti-backgrounding tool.
</p>

<h2> Interface </h2>

<pre>
     s6-fghack <em>prog...</em>
</pre>

<ul>
 <li> s6-fghack opens a lot of file descriptors (all writing to a single pipe). </li>
 <li> Then it forks and executes <em>prog...</em>. </li>
 <li> If something gets written on one of those descriptors, it's a bug in <em>prog</em>.
s6-fghack then complains and exits 102. </li>
 <li> Unless <em>prog...</em> goes out of its way to close descriptors it does not know about,
s6-fghack is able to detect when <em>prog...</em> exits. It exits with the same exit
code (or 111 if <em>prog...</em> has crashed). </li>
</ul>

<h2> Notes </h2>

<p>
 s6-fghack is what it says: a hack. Ideally, you should never have to use it.
It is only useful when you want to supervise a daemon that does not provide a
"stay in the foreground" option; and even then, the right thing is to report
this as a bug to the daemon author and have it fixed.
</p>

</body>
</html>