Why does `disown -h` make chromium-browser survive closing its terminal emulator tab?











up vote
-2
down vote

favorite












In Why is chromium-browser killed when I close the terminal despite nohup?, I wrote that in a Terminal emulator tab, I ran



$ nohup chromium-browser &


When I close the terminal tab, chromium-browser also exits. Mark replied it was because chromium-browser overrides the action of SIGHUP from ignore to default (terminate).



When I repeat the above with disown -h in place of nohup,



$ chromium-browser & disown -h


why doesn't chromium-browser terminate when I close its terminal tab? (Note that disown -h doesn't remove the chromium-browser process from the job list in the shell, so I think the chromium-browser process still receives SIGHUP from the shell)



Thanks.










share|improve this question




















  • 1




    what makes you think so? run help disown in bash and read the definition of the -h option 50 times ;-)
    – mosvy
    Nov 27 at 2:03















up vote
-2
down vote

favorite












In Why is chromium-browser killed when I close the terminal despite nohup?, I wrote that in a Terminal emulator tab, I ran



$ nohup chromium-browser &


When I close the terminal tab, chromium-browser also exits. Mark replied it was because chromium-browser overrides the action of SIGHUP from ignore to default (terminate).



When I repeat the above with disown -h in place of nohup,



$ chromium-browser & disown -h


why doesn't chromium-browser terminate when I close its terminal tab? (Note that disown -h doesn't remove the chromium-browser process from the job list in the shell, so I think the chromium-browser process still receives SIGHUP from the shell)



Thanks.










share|improve this question




















  • 1




    what makes you think so? run help disown in bash and read the definition of the -h option 50 times ;-)
    – mosvy
    Nov 27 at 2:03













up vote
-2
down vote

favorite









up vote
-2
down vote

favorite











In Why is chromium-browser killed when I close the terminal despite nohup?, I wrote that in a Terminal emulator tab, I ran



$ nohup chromium-browser &


When I close the terminal tab, chromium-browser also exits. Mark replied it was because chromium-browser overrides the action of SIGHUP from ignore to default (terminate).



When I repeat the above with disown -h in place of nohup,



$ chromium-browser & disown -h


why doesn't chromium-browser terminate when I close its terminal tab? (Note that disown -h doesn't remove the chromium-browser process from the job list in the shell, so I think the chromium-browser process still receives SIGHUP from the shell)



Thanks.










share|improve this question















In Why is chromium-browser killed when I close the terminal despite nohup?, I wrote that in a Terminal emulator tab, I ran



$ nohup chromium-browser &


When I close the terminal tab, chromium-browser also exits. Mark replied it was because chromium-browser overrides the action of SIGHUP from ignore to default (terminate).



When I repeat the above with disown -h in place of nohup,



$ chromium-browser & disown -h


why doesn't chromium-browser terminate when I close its terminal tab? (Note that disown -h doesn't remove the chromium-browser process from the job list in the shell, so I think the chromium-browser process still receives SIGHUP from the shell)



Thanks.







bash disown chromium-browser






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 26 at 22:29

























asked Nov 26 at 22:14









Tim

25.1k72243441




25.1k72243441








  • 1




    what makes you think so? run help disown in bash and read the definition of the -h option 50 times ;-)
    – mosvy
    Nov 27 at 2:03














  • 1




    what makes you think so? run help disown in bash and read the definition of the -h option 50 times ;-)
    – mosvy
    Nov 27 at 2:03








1




1




what makes you think so? run help disown in bash and read the definition of the -h option 50 times ;-)
– mosvy
Nov 27 at 2:03




what makes you think so? run help disown in bash and read the definition of the -h option 50 times ;-)
– mosvy
Nov 27 at 2:03










1 Answer
1






active

oldest

votes

















up vote
1
down vote













chromium is a bit complicated, so let's use sleep instead.



$ nohup sleep 1000 >& /dev/null &
[1] 5283


Here we have a sleep process that ignores HUP. Demonstrate by sending HUP:



$ kill -SIGHUP 5283
$ kill -SIGHUP 5283
$ kill -SIGHUP 5283


See? Nothing happens.



Let's try this again with disown:



$ sleep 1000 &
[1] 5293
$ disown -h


Here we have a sleep process that doesn't ignore HUP. Demonstrate by sending HUP:



$ kill -SIGHUP 5293
$ kill -SIGHUP 5293
bash: kill: (5293) - No such process
[1]+ Hangup sleep 1000


Hups, it died.



You can also do this in a new terminal after closing the old one. So apparently, closing the terminal does not send HUP after disown -h.



So why doesn't nohup chromium ignore HUP? nohup sets HUP to ignore, but chromium may choose to revert that. So nohup is super uneffective on processes that have their own ideas about signal handlers.



One way to make a process that chooses to not ignore HUP to ignore HUP anyway is to not send HUP in the first place so it won't know about the HUP and doesn't matter whether or how it handles HUP.






share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f484315%2fwhy-does-disown-h-make-chromium-browser-survive-closing-its-terminal-emulator%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    chromium is a bit complicated, so let's use sleep instead.



    $ nohup sleep 1000 >& /dev/null &
    [1] 5283


    Here we have a sleep process that ignores HUP. Demonstrate by sending HUP:



    $ kill -SIGHUP 5283
    $ kill -SIGHUP 5283
    $ kill -SIGHUP 5283


    See? Nothing happens.



    Let's try this again with disown:



    $ sleep 1000 &
    [1] 5293
    $ disown -h


    Here we have a sleep process that doesn't ignore HUP. Demonstrate by sending HUP:



    $ kill -SIGHUP 5293
    $ kill -SIGHUP 5293
    bash: kill: (5293) - No such process
    [1]+ Hangup sleep 1000


    Hups, it died.



    You can also do this in a new terminal after closing the old one. So apparently, closing the terminal does not send HUP after disown -h.



    So why doesn't nohup chromium ignore HUP? nohup sets HUP to ignore, but chromium may choose to revert that. So nohup is super uneffective on processes that have their own ideas about signal handlers.



    One way to make a process that chooses to not ignore HUP to ignore HUP anyway is to not send HUP in the first place so it won't know about the HUP and doesn't matter whether or how it handles HUP.






    share|improve this answer

























      up vote
      1
      down vote













      chromium is a bit complicated, so let's use sleep instead.



      $ nohup sleep 1000 >& /dev/null &
      [1] 5283


      Here we have a sleep process that ignores HUP. Demonstrate by sending HUP:



      $ kill -SIGHUP 5283
      $ kill -SIGHUP 5283
      $ kill -SIGHUP 5283


      See? Nothing happens.



      Let's try this again with disown:



      $ sleep 1000 &
      [1] 5293
      $ disown -h


      Here we have a sleep process that doesn't ignore HUP. Demonstrate by sending HUP:



      $ kill -SIGHUP 5293
      $ kill -SIGHUP 5293
      bash: kill: (5293) - No such process
      [1]+ Hangup sleep 1000


      Hups, it died.



      You can also do this in a new terminal after closing the old one. So apparently, closing the terminal does not send HUP after disown -h.



      So why doesn't nohup chromium ignore HUP? nohup sets HUP to ignore, but chromium may choose to revert that. So nohup is super uneffective on processes that have their own ideas about signal handlers.



      One way to make a process that chooses to not ignore HUP to ignore HUP anyway is to not send HUP in the first place so it won't know about the HUP and doesn't matter whether or how it handles HUP.






      share|improve this answer























        up vote
        1
        down vote










        up vote
        1
        down vote









        chromium is a bit complicated, so let's use sleep instead.



        $ nohup sleep 1000 >& /dev/null &
        [1] 5283


        Here we have a sleep process that ignores HUP. Demonstrate by sending HUP:



        $ kill -SIGHUP 5283
        $ kill -SIGHUP 5283
        $ kill -SIGHUP 5283


        See? Nothing happens.



        Let's try this again with disown:



        $ sleep 1000 &
        [1] 5293
        $ disown -h


        Here we have a sleep process that doesn't ignore HUP. Demonstrate by sending HUP:



        $ kill -SIGHUP 5293
        $ kill -SIGHUP 5293
        bash: kill: (5293) - No such process
        [1]+ Hangup sleep 1000


        Hups, it died.



        You can also do this in a new terminal after closing the old one. So apparently, closing the terminal does not send HUP after disown -h.



        So why doesn't nohup chromium ignore HUP? nohup sets HUP to ignore, but chromium may choose to revert that. So nohup is super uneffective on processes that have their own ideas about signal handlers.



        One way to make a process that chooses to not ignore HUP to ignore HUP anyway is to not send HUP in the first place so it won't know about the HUP and doesn't matter whether or how it handles HUP.






        share|improve this answer












        chromium is a bit complicated, so let's use sleep instead.



        $ nohup sleep 1000 >& /dev/null &
        [1] 5283


        Here we have a sleep process that ignores HUP. Demonstrate by sending HUP:



        $ kill -SIGHUP 5283
        $ kill -SIGHUP 5283
        $ kill -SIGHUP 5283


        See? Nothing happens.



        Let's try this again with disown:



        $ sleep 1000 &
        [1] 5293
        $ disown -h


        Here we have a sleep process that doesn't ignore HUP. Demonstrate by sending HUP:



        $ kill -SIGHUP 5293
        $ kill -SIGHUP 5293
        bash: kill: (5293) - No such process
        [1]+ Hangup sleep 1000


        Hups, it died.



        You can also do this in a new terminal after closing the old one. So apparently, closing the terminal does not send HUP after disown -h.



        So why doesn't nohup chromium ignore HUP? nohup sets HUP to ignore, but chromium may choose to revert that. So nohup is super uneffective on processes that have their own ideas about signal handlers.



        One way to make a process that chooses to not ignore HUP to ignore HUP anyway is to not send HUP in the first place so it won't know about the HUP and doesn't matter whether or how it handles HUP.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 26 at 22:54









        frostschutz

        25.6k15280




        25.6k15280






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f484315%2fwhy-does-disown-h-make-chromium-browser-survive-closing-its-terminal-emulator%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            サソリ

            広島県道265号伴広島線

            Setup Asymptote in Texstudio