[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Forcing builtins (interactive, non-interactive shells) to execute in for
Forcing builtins (interactive, non-interactive shells) to execute in fork()'ed process.
Wed, 26 Oct 2016 15:00:20 -0700
Workspace Webmail 6.5.3
I'm doing some testing with an on-screen colorizer library I wrote,
some PTY manipulation, captures screen output, and renders certain regex
patterns in certain colors. It's designed to help testers notice certain
keywords in a test environment that is not easily automated.
On bash 4.3.36 on Ubuntu 16.04 LTS, I've noticed that all commands seem
fork() a separate process, even shell builtins. This makes it easy to
the start of any command by hooking fork() in libc. However, on bash
Ubuntu 14.04 LTS, this behavior is not observed (ie: only "disk
a fork(), while builtins do not trigger a fork). Additionally, when
running in a
non-interactive bash instance, shell builtins never cause a fork,
whether I'm running a script (ie: ./test.sh), or using bash via the "-c"
(ie: bash -c "ls; ls -la").
Is there any way, either via environment variables, BASHRC settings, or
startup flags, or some other means (ie: not recompiling bash) where I
1) Have bash 4.3.11 fork() for every interactive command, like in bash
2) Have both bash 4.3.11 and 4.3.36 trigger a fork() for builtins being
in a non-interactive shell?
I could potentially use PROMPT_COMMAND to detect the most recent
it, and force running in a subshell, but I want to avoid breaking other
by changing how commands are actually executed, save for forking.
On a side note, its interesting how bash 4.3.36 does this, even for the
command, since launching it in a subshell can't change the CWD for the
Matthew Giassa, MASc, BASc, EIT
Security and Embedded Systems Specialist
|[Prev in Thread]
||[Next in Thread]|
- Forcing builtins (interactive, non-interactive shells) to execute in fork()'ed process.,
Matthew Giassa <=