aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/swabber-strace-attach
blob: bb0391a7cadebf86a9e1652cd539cf4ae2916044 (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
#!/usr/bin/env python
import os
import sys
import subprocess

# Detach from the controlling terminal and parent process by forking twice to daemonize ourselves,
# then run the command passed as argv[1]. Send log data to argv[2].

pid = os.fork()
if (pid == 0):
    os.setsid()
    pid = os.fork()
    if (pid != 0):
        os._exit(0)
else:
    sys.exit()


si = file(os.devnull, 'r')
so = file(sys.argv[2], 'w')
se = so

# Replace those fds with our own
os.dup2(si.fileno(), sys.stdin.fileno())
os.dup2(so.fileno(), sys.stdout.fileno())
os.dup2(se.fileno(), sys.stderr.fileno())

ret = subprocess.call(sys.argv[1], shell=True)

os._exit(ret)
n class="s">'1' width='100%'/> </imageobject> </mediaobject> <title> Yocto Project Overview and Concepts Manual </title> <authorgroup> <author> <firstname>Scott</firstname> <surname>Rifenbark</surname> <affiliation> <orgname>Scotty's Documentation Services, INC</orgname> </affiliation> <email>srifenbark@gmail.com</email> </author> </authorgroup> <revhistory> <revision> <revnumber>2.5</revnumber> <date>May 2018</date> <revremark>The initial document released with the Yocto Project 2.5 Release.</revremark> </revision> <revision> <revnumber>2.6</revnumber> <date>November 2018</date> <revremark>Released with the Yocto Project 2.7 Release.</revremark> </revision> <revision> <revnumber>2.7</revnumber> <date>May 2019</date> <revremark>Released with the Yocto Project 2.7 Release.</revremark> </revision> <revision> <revnumber>2.8</revnumber> <date>&REL_MONTH_YEAR;</date> <revremark>Released with the Yocto Project 2.8 Release.</revremark> </revision> </revhistory> <copyright> <year>&COPYRIGHT_YEAR;</year> <holder>Linux Foundation</holder> </copyright> <legalnotice> <para> Permission is granted to copy, distribute and/or modify this document under the terms of the <ulink type="http" url="http://creativecommons.org/licenses/by-sa/2.0/uk/"> Creative Commons Attribution-Share Alike 2.0 UK: England &amp; Wales</ulink> as published by Creative Commons. </para> <note><title>Manual Notes</title> <itemizedlist> <listitem><para> This version of the <emphasis>Yocto Project Overview and Concepts Manual</emphasis> is for the &YOCTO_DOC_VERSION; release of the Yocto Project. To be sure you have the latest version of the manual for this release, go to the <ulink url='&YOCTO_HOME_URL;/documentation'>Yocto Project documentation page</ulink> and select the manual from that site. Manuals from the site are more up-to-date than manuals derived from the Yocto Project released TAR files. </para></listitem> <listitem><para> If you located this manual through a web search, the version of the manual might not be the one you want (e.g. the search might have returned a manual much older than the Yocto Project version with which you are working). You can see all Yocto Project major releases by visiting the <ulink url='&YOCTO_WIKI_URL;/wiki/Releases'>Releases</ulink> page. If you need a version of this manual for a different Yocto Project release, visit the <ulink url='&YOCTO_HOME_URL;/documentation'>Yocto Project documentation page</ulink> and select the manual set by using the "ACTIVE RELEASES DOCUMENTATION" or "DOCUMENTS ARCHIVE" pull-down menus. </para></listitem> <listitem><para> To report any inaccuracies or problems with this manual, send an email to the Yocto Project discussion group at <filename>yocto@yoctoproject.com</filename> or log into the freenode <filename>#yocto</filename> channel. </para></listitem> </itemizedlist> </note> </legalnotice> </bookinfo> <xi:include href="overview-manual-intro.xml"/> <xi:include href="overview-manual-yp-intro.xml"/> <xi:include href="overview-manual-development-environment.xml"/> <xi:include href="overview-manual-concepts.xml" /> </book> <!-- vim: expandtab tw=80 ts=4 -->