<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/spawn.c, branch 1.24.0</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=1.24.0</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=1.24.0'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2024-07-23T05:17:21Z</updated>
<entry>
<title>spawn: add optional reaper callback, return pid_t</title>
<updated>2024-07-23T05:17:21Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-07-23T04:57:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=a42f99081876dd02e28b931f7c0e70230355bb58'/>
<id>urn:sha1:a42f99081876dd02e28b931f7c0e70230355bb58</id>
<content type='text'>
This will allow spawn() callers to do things when the spawned process
has terminated.
</content>
</entry>
<entry>
<title>Replace unchecked allocations with calls to xmalloc.h functions</title>
<updated>2024-01-25T07:03:50Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2024-01-25T07:03:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=91b22ae21acd0b3171814b47b0dead027f8da779'/>
<id>urn:sha1:91b22ae21acd0b3171814b47b0dead027f8da779</id>
<content type='text'>
</content>
</entry>
<entry>
<title>spawn: set $PWD, in addition to calling chdir(cwd)</title>
<updated>2022-10-02T18:11:16Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-09-26T17:16:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=332cb90134bf7ba4f5248147aeee9f8f6a99a579'/>
<id>urn:sha1:332cb90134bf7ba4f5248147aeee9f8f6a99a579</id>
<content type='text'>
</content>
</entry>
<entry>
<title>url-mode: add support for XDG activation when opening URLs</title>
<updated>2022-05-05T08:02:28Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-05-03T17:37:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=ea1aac88db3a6d9f368406676c3e5a0cedcafd57'/>
<id>urn:sha1:ea1aac88db3a6d9f368406676c3e5a0cedcafd57</id>
<content type='text'>
First, add a ‘token’ argument to spawn(). When non-NULL, spawn() will
set the ‘XDG_ACTIVATION_TOKEN’ environment variable in the forked
process. If DISPLAY is non-NULL, we also set DESKTOP_STARTUP_ID, for
compatibility with X11 applications. Note that failing to set either
of these environment variables are considered non-fatal - i.e. we
ignore failures.

Next, add a helper function, wayl_get_activation_token(), to generate
an XDG activation token, and call a user-provided callback when it’s
‘done (since token generation is asynchronous). This function takes an
optional ‘seat’ and ‘serial’ arguments - when both are non-NULL/zero,
we set the serial on the token. ‘win’ is a required argument, used to
set the surface on the token.

Re-write wayl_win_set_urgent() to use the new helper function.

Finally, rewrite activate_url() to first try to get an activation
token (and spawn the URL launcher in the token callback). If that
fails, or if we don’t have XDG activation support, spawn the URL
launcher immediately (like before this patch).

Closes #1058
</content>
</entry>
<entry>
<title>Explicitly initialize sigaction::sa_mask members with sigemptyset(3)</title>
<updated>2022-02-12T12:26:42Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2022-02-12T12:04:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=23cf80667a36aaff1865fc50afab3f98a796cf14'/>
<id>urn:sha1:23cf80667a36aaff1865fc50afab3f98a796cf14</id>
<content type='text'>
Not doing so before calling sigaction(3) is "undefined" according to
POSIX[1]:

&gt; Applications shall call either sigemptyset() or sigfillset() at least
&gt; once for each object of type sigset_t prior to any other use of that
&gt; object. If such an object is not initialized in this way, but is
&gt; nonetheless supplied as an argument to any of pthread_sigmask(),
&gt; sigaction(), sigaddset(), sigdelset(), sigismember(), sigpending(),
&gt; sigprocmask(), sigsuspend(), sigtimedwait(), sigwait(), or
&gt; sigwaitinfo(), the results are undefined.

The use of designated initializers means that sa_mask members were
still being initialized, but sigset_t is an opaque type and implicit
initialization doesn't necessarily produce the same results as using
sigemptyset(3) (although it typically does on most implementations).

[1]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaddset.html
</content>
</entry>
<entry>
<title>spawn: don’t error out if we fail to chdir()</title>
<updated>2021-08-30T15:55:36Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-08-30T15:55:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=ac30da7a01b55ec4778f96c70dc3b8b6ab791272'/>
<id>urn:sha1:ac30da7a01b55ec4778f96c70dc3b8b6ab791272</id>
<content type='text'>
</content>
</entry>
<entry>
<title>config: add new function config_clone()</title>
<updated>2021-06-23T08:39:14Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-06-18T14:18:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=f7860aec7610be897155046bd730ad0b406bd56c'/>
<id>urn:sha1:f7860aec7610be897155046bd730ad0b406bd56c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>slave/spawn: restore SIGHUP handler after fork(), before exec()</title>
<updated>2021-06-02T18:13:14Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-06-02T15:48:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=a72b2688bda87a20d029e80eaf8d6686ca95003e'/>
<id>urn:sha1:a72b2688bda87a20d029e80eaf8d6686ca95003e</id>
<content type='text'>
Foot installs a SIG_IGN handler for SIGHUP. Ignored signals are
inherited in sub-processes. Thus, we need to restore it to SIG_DFL
before exec:ing.
</content>
</entry>
<entry>
<title>spawn: call setsid() in child process</title>
<updated>2021-02-25T20:09:59Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-25T20:09:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=4e577110127702c450a2ae3eddab3e97e55127cd'/>
<id>urn:sha1:4e577110127702c450a2ae3eddab3e97e55127cd</id>
<content type='text'>
</content>
</entry>
<entry>
<title>spawn: handle custom stdin/stdout/stderr fds being the same</title>
<updated>2021-02-24T20:29:34Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-24T20:29:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=9cb8f6e3b7549b1f279f6de34a97c0e568f4d148'/>
<id>urn:sha1:9cb8f6e3b7549b1f279f6de34a97c0e568f4d148</id>
<content type='text'>
Allow the caller to pass the same FD (for example, a single /dev/null
FD) to spawn().

All we need to do to handle this correctly is ensure we don’t try to
close the same FD multiple times.
</content>
</entry>
<entry>
<title>errno: don’t use ‘_errno’ as a variable name; _ are reserved for use as identifiers</title>
<updated>2021-02-21T19:33:07Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-21T19:33:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=555f751f94a7efa90f03713a876f41f2424ea9f0'/>
<id>urn:sha1:555f751f94a7efa90f03713a876f41f2424ea9f0</id>
<content type='text'>
</content>
</entry>
<entry>
<title>spawn/slave: restore signal mask after fork</title>
<updated>2021-02-21T18:59:50Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-21T10:57:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=dd5c31657ee934c52f24fd77778c56468d668b45'/>
<id>urn:sha1:dd5c31657ee934c52f24fd77778c56468d668b45</id>
<content type='text'>
slave: no need to restore signal handlers; they are automatically
restored as long as they are not SIG_IGN (which they never are in
foot).

spawn(): restore signal mask after fork. This fixes an issue where a
terminal spawned with ctrl+shift+n did not terminate when its shell
exited.

Closes #366
</content>
</entry>
<entry>
<title>notify: break out command template expansion to spawn_expand_template()</title>
<updated>2021-02-07T15:33:32Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-01-31T13:40:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=06aba59430bdb1ad5058ef513eeb91416057d1db'/>
<id>urn:sha1:06aba59430bdb1ad5058ef513eeb91416057d1db</id>
<content type='text'>
</content>
</entry>
<entry>
<title>debug: rename assert() to xassert(), to avoid clashing with &lt;assert.h&gt;</title>
<updated>2021-01-16T20:16:00Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2021-01-16T20:16:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e56136ce1192d04a52b01ccb41284f0b7896430e'/>
<id>urn:sha1:e56136ce1192d04a52b01ccb41284f0b7896430e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Print stack trace on assert() failure or when calling fatal_error()</title>
<updated>2021-01-16T19:56:33Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2021-01-15T20:39:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=22f25a9e4feddbc093ae01cd53bdda3c2c3a82e9'/>
<id>urn:sha1:22f25a9e4feddbc093ae01cd53bdda3c2c3a82e9</id>
<content type='text'>
Note: this uses the __sanitizer_print_stack_trace() function from the
AddressSanitizer runtime, so it only works when AddressSanitizer is
in use.
</content>
</entry>
<entry>
<title>reaper: add optional callback</title>
<updated>2020-12-26T00:26:54Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-26T00:26:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=3c6789fb8ba87810a2aa83eebf6eea10c969db6d'/>
<id>urn:sha1:3c6789fb8ba87810a2aa83eebf6eea10c969db6d</id>
<content type='text'>
When calling ‘reaper_add()’, the caller can provide a callback. If
non-NULL, the reaper will call the callback to handle the actual
reaping.

If the callback is NULL, or if it returns false, the reaper reaps the
child process.
</content>
</entry>
<entry>
<title>log: include 'fmt' in __VA_ARGS__</title>
<updated>2020-08-23T08:07:08Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-08-23T05:44:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=c779a5ec7deecf91cb9aca298af90cbc2d9c04d7'/>
<id>urn:sha1:c779a5ec7deecf91cb9aca298af90cbc2d9c04d7</id>
<content type='text'>
This ensures all calls have at least one __VA_ARGS__ argument, thus
making them ISO C99 compliant.
</content>
</entry>
<entry>
<title>spawn: add optional stdin/stdout/stderr redirection FDs</title>
<updated>2020-07-15T11:33:56Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-07-15T11:33:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=69d9ff3f2573dc46d558a5134a93165a7ec212d0'/>
<id>urn:sha1:69d9ff3f2573dc46d558a5134a93165a7ec212d0</id>
<content type='text'>
If not -1, spawn() will redirect the child's stdin/stdout/stderr to
these FDs.
</content>
</entry>
<entry>
<title>term: break out fork+exec functionality to a separate file</title>
<updated>2020-07-15T10:39:10Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-07-15T10:39:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=9cdccdd2ac5140a5a265926501a919a3b86f8d84'/>
<id>urn:sha1:9cdccdd2ac5140a5a265926501a919a3b86f8d84</id>
<content type='text'>
</content>
</entry>
</feed>
