[io] Prevent losing data due to SIGTERM (under Unix)#18403
[io] Prevent losing data due to SIGTERM (under Unix)#18403ferdymercury wants to merge 2 commits intoroot-project:masterfrom
Conversation
Test Results 22 files 22 suites 3d 18h 35m 56s ⏱️ For more details on these failures, see this check. Results for commit 64374c4. ♻️ This comment has been updated with latest results. |
|
@ferdymercury The SIGILL and SIGTERM signals aren't generated under Windows. They're included for ANSI compatibility. See the signal reference |
|
Let's have a look to the tests once again |
| // gentle save and close if SIGTERM | ||
| if (signum == SIGTERM) { |
There was a problem hiding this comment.
If I understood correctly, this would mean that after code similar to:
root [] TFile f(filename, RECREATE);
root [] do_stuff();
root [] if (all_is_well) f.Write();
We have a different behavior if the user does:
root [] .q
and
send SIGTERM
Where the former does not write the file while the later would now write the file.
There was a problem hiding this comment.
As I tried to explain here, #13300 (comment), I think this is a logical behaviour. The prompt experience does not change. The behaviour if SIGKILL is used does not change. However, if SIGTERM is used, some kind of "soft termination" that gives the process a way to wrap up and end gracefully, is the right thing to do.
There was a problem hiding this comment.
We could create a ".wq" ROOT command (one char longer than ".q") to do the equivalent of save and exit as if it were vim, if one wants to rely on this without having to look how to send SIGTERM. Or just for symmetry with SIGNALS.
f6f707e to
4f28265
Compare
571cd12 to
beb694c
Compare
|
I would be in favour of approving, @pcanal , but only if you also agree with the point I made above. |
Fixes root-project#13300 [core] Implement public static functions allowing save and close [io] only SaveAndClose TFiles and derived TSystemFile, in general, does not implemente Write and Close methods [io] Do not write/close files open in READ mode [core] use TDirectory instead TMethodCall
This Pull request:
Changes or fixes:
Fixes #13300
Checklist: