mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:47:45 +00:00
Shell: Properly set and restore termios settings.
Previously, we did not properly restore termios settings after running built-in commands. This has been fixed by ensuring that we only change the termios settings when we are forking a child process.
This commit is contained in:
parent
378480e8e4
commit
058c8337df
1 changed files with 1 additions and 1 deletions
|
@ -634,7 +634,6 @@ static int run_command(const String& cmd)
|
||||||
|
|
||||||
struct termios trm;
|
struct termios trm;
|
||||||
tcgetattr(0, &trm);
|
tcgetattr(0, &trm);
|
||||||
tcsetattr(0, TCSANOW, &g.default_termios);
|
|
||||||
|
|
||||||
struct SpawnedProcess {
|
struct SpawnedProcess {
|
||||||
String name;
|
String name;
|
||||||
|
@ -730,6 +729,7 @@ static int run_command(const String& cmd)
|
||||||
if (!child) {
|
if (!child) {
|
||||||
setpgid(0, 0);
|
setpgid(0, 0);
|
||||||
tcsetpgrp(0, getpid());
|
tcsetpgrp(0, getpid());
|
||||||
|
tcsetattr(0, TCSANOW, &g.default_termios);
|
||||||
for (auto& rewiring : subcommand.rewirings) {
|
for (auto& rewiring : subcommand.rewirings) {
|
||||||
#ifdef SH_DEBUG
|
#ifdef SH_DEBUG
|
||||||
dbgprintf("in %s<%d>, dup2(%d, %d)\n", argv[0], getpid(), rewiring.rewire_fd, rewiring.fd);
|
dbgprintf("in %s<%d>, dup2(%d, %d)\n", argv[0], getpid(), rewiring.rewire_fd, rewiring.fd);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue