Remove session-specific directory if module is given Ctrl-C#5739
Remove session-specific directory if module is given Ctrl-C#5739PaulWessel merged 28 commits intomasterfrom
Conversation
|
Doing multiple tests starting a session and I don't know if this is of any help, but just in case; other outcomes include: |
|
Please try a few without the process substitution which is a separate process running. Just so we can compare |
|
Basically, gmt has no way of knowing that you kill the makecpt command with Ctrl-C, just that something suddenly got removed in the middle of another module... |
|
Seems to work better with no process substitution. Still, again, some problems with the terminal not being responsive. And other cases, just to give an impression what the user may see: Session was not deleted in this case, so: Need to clear: |
|
Interesting. Hard to debug these things in the debugger... |
|
Let me know if my changes make any difference. |
|
hi @anbj the latest also calls GMT_Destroy_Session, perhaps that prevents some of the messages you get, but not sure. It seems to report errors after I call exit, which is odd. |
|
(I could not Still getting a good mix. But I think is works better now. |
|
I will test this on my Linux laptop today so maybe I can learn some more. Those strange message from malloc sysmalloc is not GMT so I wonder if exit is a macro on your Linux or similar. exit should just exit, not fuss... |
|
Maybe. I'm on Debian 11 Bullseye, if that helps. And, please don't hesitate to say stop if this is getting too hairy and taking up too much time. |
|
Could @joa-quim perhaps check if this works on WIndows? (Compile, run, CTRL-C the program). We should be able to do Ctrl-C checking on all OS even if the backtrace stuff will be limited to the *nix case. Right now it is all or nothing and Windows is excluded. May even be more important to do this on WIndows since the PID is hardwired to 1. |
|
Hi @anbj - the latest commit works pretty good for me on CentOS. I made some changes that possibly stabilizes things for you as well. let me know. |
|
Yes, works better now. Some snacks though: (Need to clean this manually now with |
|
It does no fix the issue that seems to be that the |
|
I found an issue in the CMakeLists.txt file: The libgmt list includes gmt_common_sighandler.c twice instead of both c and h. That was probably it all along. Please check again. |
|
Not yet. Still same linking error. |
|
Assuming you fully cleared byte build dir and rebuilt, this makes no sense. Can you think of anything that is different her w.r.t. that function relative to all other GMT exported functions? |
|
Don't know. or some reason the |
|
Can you run a win command to see the list of functions inside the gmt.dll
and check if it is there or not? Next would be to add some #message
statements in the areas where that function is declared and prototyped to
see if/why the compiler skips those sections.
On September 30, 2021 at 11:04:42 AM, Joaquim ***@***.***) wrote:
Don't know. or some reason the sig_handler_win32 function does not land in
the gmt.dll
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#5739 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGJ7IX4OSH5RFUZRFAESPYDUETGGVANCNFSM5DV3HSOQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
|
I can SEE that it's not in the dll and functions are not being skipped. Many attempts to change things gave compiling errors. So it's being compiled. But it just vanishes. |
|
@joa-quim, I have made a few changes to where prototypes are listed etc, perhaps this will help (or not). |
|
Yes, now it worked But it must take care that |
Do you mean should this be under #ifndef WIN32? |
|
I think the answer to my question is yes since those are Unix sys includes. I will add the ifndef. |
|
That is somehow already under an |
|
OK, so now it cannot be set under WIN32. I will merge this PR once the checks completes. |
See #5730 for background. This PR reinstates a check for SIG_INT but the sig_handler has been changed to simply call gmtlib_terminate_session () which will delete the current session directory so that we do not leave useless junk behind. Closes #5730.
We need to test this a bit though. Again, not supported on Windows unless @joa-quim knows how it works there. Run a modern mode command and hit Ctrl-C before it finishes. You should see a message like this
The session directory should have been removed and you can run the same command (without Ctrl-C) and it will not complain about being in a modern mode session already.
This PR also makes a few changes in gmt.c by now listening for SIG_INT and then doing the above if caught.
Note: If you are running a modern mode script and you hit Ctrl-C then there are complications:
We cannot control those things, but we can control interrupting a module.
We could also explain all of this, the way we ensure session continuity etc to preempt dumb things like running gmt begin in one terminal and running the next command in another terminal, or putting a gmt modern mode script in the background (prompt$ my_long_script.sh &) and then run another script in the same terminal. I think that will cause interference.