taviso / 123elf

A native port of Lotus 1-2-3 to Linux.
1.17k stars 59 forks source link

Re-implement shell functionality #47

Closed jserv closed 2 years ago

jserv commented 2 years ago

"/System" is supposed to redirect to a command shell, useful for macros. However, the terminal would mess up. Symbol "symbol" is now overridden by the combination of termio and posix_spawn, which respect the original terminal configurations.

Close #15

taviso commented 2 years ago

wow thanks! It works a lot better, although iI still get one error, after exiting it says "a -- Press HELP", do you see that too?

jserv commented 2 years ago

wow thanks! It works a lot better, although iI still get one error, after exiting it says "a -- Press HELP", do you see that too?

Yes, I saw that message. Maybe I should check the return value properly.

taviso commented 2 years ago

I think unset_raw_mode() isn't working for some reason... maybe the terminal is still sending input events and the unexpected input is causing that error?

taviso commented 2 years ago

This termios stuff is a real pain to debug, but maybe if that starts working the stty sane won't be necessary..? Give me chance to figure that out and then we'll see if the "a -- press help" thing goes away.

taviso commented 2 years ago

I think that error is coming from the SIGCHLD handler, I think if we just signal(SIGCHLD, SIG_DFL) it will go away? I have a patch that does that and cleans up rawmode. I can't work on this until tonight, I'll push the updates then!

taviso commented 2 years ago

Just a random thought I haven't tested.. could the puts() with control codes be replaced with reset_shell_mode()/reset_prog_mode()? No problem if it doesn't work, would just look a bit neater!

jserv commented 2 years ago

I think that error is coming from the SIGCHLD handler, I think if we just signal(SIGCHLD, SIG_DFL) it will go away? I have a patch that does that and cleans up rawmode. I can't work on this until tonight, I'll push the updates then!

I have added signal(SIGCHLD, SIG_DFL) into this patch, and it works as expected.

jserv commented 2 years ago

Without tput cnorm, the cursor would hide completely. So, I attempt to run it before launching the real shell process.

jserv commented 2 years ago

@taviso, I suddenly deleted my forked repository, and this pull request was closed corresponding. Please reopen if you think it was useful.

taviso commented 2 years ago

Oops - no problem, I was working on it and trying to test with macros. The patch works, I was just experimenting with it to see if there was a way to do it without the escape codes!