What could cause this trap on EXIT to never fire?What is signal 0 in a trap command?“trap … INT TERM...

What aircraft was used as Air Force One for the flight between Southampton and Shannon?

What is the color of artificial intelligence?

How can I end combat quickly when the outcome is inevitable?

New pedal fell off maybe 50 miles after installation. Should I replace the entire crank, just the arm, or repair the thread?

Live action TV show where High school Kids go into the virtual world and have to clear levels

With Ubuntu 18.04, how can I have a hot corner that locks the computer?

Moving points closer to polyline using ModelBuilder?

How come the nude protesters were not arrested?

Teaching a class likely meant to inflate the GPA of student athletes

Is it possible for a vehicle to be manufactured without a catalytic converter?

Why we don’t make use of the t-distribution for constructing a confidence interval for a proportion?

Getting UPS Power from One Room to Another

Why does Sin[b-a] simplify to -Sin[a-b]?

What is the maximum number of net attacks that one can make in a round?

Electricity free spaceship

Why does the Mishnah use the terms poor person and homeowner when discussing carrying on Shabbat?

Is it expected that a reader will skip parts of what you write?

Is it possible to have a wealthy country without a middle class?

LuaLaTex - how to use number, computed later in the document

What is inside of the 200 star chest?

Non-aqueous eyes?

How is the excise border managed in Ireland?

Should I ask for an extra raise?

A word that means "blending into a community too much"



What could cause this trap on EXIT to never fire?


What is signal 0 in a trap command?“trap … INT TERM EXIT” really necessary?Skip 'natural' exit in trapgrep causes EXIT trap in bash scriptexit trap in dash vs ksh and bashbash script trap for exit and err and logic for differenceDifference between 'trap -⁠- EXIT' and 'trap - EXIT'Trap 'Ctrl + c' for bash script but not for process open in this scriptUse bash EXIT trap to confirm or cancel ctrl+dEXIT Trap with POSIX






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















echo ' *** Site up, starting tests.'

cleanup() {
rv=$?
# kill server and mock data server at the end
kill $(lsof -i4TCP:3001 -sTCP:LISTEN -t) &>/dev/null;
kill $(lsof -i4TCP:3003 -sTCP:LISTEN -t) &>/dev/null;
echo "Finished. Exit code: $rv"
exit $rv
}
trap cleanup EXIT

npm run --prefix functional-tests test:pipeline:chromeff

echo 'Tests complete. Cleaning up.'

exit


The script output:



*** Site up, starting tests.

(... bunch of tests run here)

8 passed (7m 06s)

5 skipped

Tests complete. Cleaning up.


It seems like that final exit is not causing the trap cleanup EXIT to fire off. What am I doing wrong?










share|improve this question





























    0















    echo ' *** Site up, starting tests.'

    cleanup() {
    rv=$?
    # kill server and mock data server at the end
    kill $(lsof -i4TCP:3001 -sTCP:LISTEN -t) &>/dev/null;
    kill $(lsof -i4TCP:3003 -sTCP:LISTEN -t) &>/dev/null;
    echo "Finished. Exit code: $rv"
    exit $rv
    }
    trap cleanup EXIT

    npm run --prefix functional-tests test:pipeline:chromeff

    echo 'Tests complete. Cleaning up.'

    exit


    The script output:



    *** Site up, starting tests.

    (... bunch of tests run here)

    8 passed (7m 06s)

    5 skipped

    Tests complete. Cleaning up.


    It seems like that final exit is not causing the trap cleanup EXIT to fire off. What am I doing wrong?










    share|improve this question

























      0












      0








      0








      echo ' *** Site up, starting tests.'

      cleanup() {
      rv=$?
      # kill server and mock data server at the end
      kill $(lsof -i4TCP:3001 -sTCP:LISTEN -t) &>/dev/null;
      kill $(lsof -i4TCP:3003 -sTCP:LISTEN -t) &>/dev/null;
      echo "Finished. Exit code: $rv"
      exit $rv
      }
      trap cleanup EXIT

      npm run --prefix functional-tests test:pipeline:chromeff

      echo 'Tests complete. Cleaning up.'

      exit


      The script output:



      *** Site up, starting tests.

      (... bunch of tests run here)

      8 passed (7m 06s)

      5 skipped

      Tests complete. Cleaning up.


      It seems like that final exit is not causing the trap cleanup EXIT to fire off. What am I doing wrong?










      share|improve this question














      echo ' *** Site up, starting tests.'

      cleanup() {
      rv=$?
      # kill server and mock data server at the end
      kill $(lsof -i4TCP:3001 -sTCP:LISTEN -t) &>/dev/null;
      kill $(lsof -i4TCP:3003 -sTCP:LISTEN -t) &>/dev/null;
      echo "Finished. Exit code: $rv"
      exit $rv
      }
      trap cleanup EXIT

      npm run --prefix functional-tests test:pipeline:chromeff

      echo 'Tests complete. Cleaning up.'

      exit


      The script output:



      *** Site up, starting tests.

      (... bunch of tests run here)

      8 passed (7m 06s)

      5 skipped

      Tests complete. Cleaning up.


      It seems like that final exit is not causing the trap cleanup EXIT to fire off. What am I doing wrong?







      bash trap






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 1 hour ago









      jcollumjcollum

      4861515




      4861515






















          0






          active

          oldest

          votes












          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',
          autoActivateHeartbeat: false,
          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%2f523436%2fwhat-could-cause-this-trap-on-exit-to-never-fire%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          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.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f523436%2fwhat-could-cause-this-trap-on-exit-to-never-fire%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

          Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

          Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

          Ciclooctatetraenă Vezi și | Bibliografie | Meniu de navigare637866text4148569-500570979m