Prevent a nodejs application from exiting

Omid Navy

I've got a cli application written in nodejs using vorpal , live in a freebsd (v9.3), I need to know is there any way to prevent the user from exiting this app or not! I want it like when the application has started , it will never exit until reboot or shutting down the system. this is very critical and I mean it no way to exit the application at any cost . Is it possible at all ?

Edit: This is what i want: when my program start ,user can not exit the program except my own exit command, So i want to somehow prevent CTRL-Z,CTRL-C Or any other things like them. I can handle the SIGINT and errors but my problem is with "CTRL-Z" which fires a SIGSTOP signal and node cant listen to it . how can I disable this CTRL-z and others at all ? or is there any other solution maybe in my code or even modifying the bsd?

Omid Navy

I found my answer in freebsd forums , here i want to share with you for those with same purpose.

As mentioned in that forum, I needed to wrap my program inside a C program which can detect and ignore signals . So this is the way:

#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>

int
main(int argc, char *argv[])
{
        /* Ignore signals from keyboard */
        signal(SIGINT, SIG_IGN);
        signal(SIGTSTP, SIG_IGN);
        signal(SIGQUIT, SIG_IGN);

    system("node path/to/your/program");
    /* Whatever needs to be done if this point is reached. */
    return (0);
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to prevent the NodeJS event loop from exiting?

From Dev

Prevent page from exiting

From Dev

Prevent container from exiting, conditionally

From Dev

JRuby - Prevent JVM from exiting

From Dev

Is this the proper way of exiting from the application?

From Dev

Prevent grep from exiting in case of nomatch

From Java

Mobaxterm: how to prevent ssh session from exiting?

From Dev

Promise prevent node process from exiting

From Dev

Prevent text selection from exiting a div

From Dev

Prevent grep from exiting in case of nomatch

From Dev

Prevent Emacs from exiting once the exit procedure has initiated?

From Dev

Prevent exit() in third-party function from exiting?

From Dev

how to prevent mocha from exiting process with status 1

From Dev

Prevent Vi from exiting with an error code when my fingers are fat

From Dev

How to prevent my threads from exiting before their work is done?

From Dev

Prevent WindowsService exiting

From Dev

How to close application from terminal same way as exiting it properly

From Dev

Using JSR-354 ExchangeRates prevents application from exiting

From Dev

How to close application from terminal same way as exiting it properly

From Dev

Prevent application from creating a gemset

From Dev

Prevent MPRIS from recognizing an application

From Dev

Android application not exiting

From Dev

Application is not exiting C#

From Dev

Prevent exiting maximized window mode

From Dev

Prevent Nginx from caching nodejs responses

From Dev

NodeJS Prevent rest of function from running

From Dev

How to prevent programmatically started python script from exiting command prompt after error?

From Dev

How to prevent a Command Line Tool from exiting before asynchronous operation completes

From Dev

Unity3d editor: how to prevent changes from being undone upon exiting play mode?

Related Related

  1. 1

    How to prevent the NodeJS event loop from exiting?

  2. 2

    Prevent page from exiting

  3. 3

    Prevent container from exiting, conditionally

  4. 4

    JRuby - Prevent JVM from exiting

  5. 5

    Is this the proper way of exiting from the application?

  6. 6

    Prevent grep from exiting in case of nomatch

  7. 7

    Mobaxterm: how to prevent ssh session from exiting?

  8. 8

    Promise prevent node process from exiting

  9. 9

    Prevent text selection from exiting a div

  10. 10

    Prevent grep from exiting in case of nomatch

  11. 11

    Prevent Emacs from exiting once the exit procedure has initiated?

  12. 12

    Prevent exit() in third-party function from exiting?

  13. 13

    how to prevent mocha from exiting process with status 1

  14. 14

    Prevent Vi from exiting with an error code when my fingers are fat

  15. 15

    How to prevent my threads from exiting before their work is done?

  16. 16

    Prevent WindowsService exiting

  17. 17

    How to close application from terminal same way as exiting it properly

  18. 18

    Using JSR-354 ExchangeRates prevents application from exiting

  19. 19

    How to close application from terminal same way as exiting it properly

  20. 20

    Prevent application from creating a gemset

  21. 21

    Prevent MPRIS from recognizing an application

  22. 22

    Android application not exiting

  23. 23

    Application is not exiting C#

  24. 24

    Prevent exiting maximized window mode

  25. 25

    Prevent Nginx from caching nodejs responses

  26. 26

    NodeJS Prevent rest of function from running

  27. 27

    How to prevent programmatically started python script from exiting command prompt after error?

  28. 28

    How to prevent a Command Line Tool from exiting before asynchronous operation completes

  29. 29

    Unity3d editor: how to prevent changes from being undone upon exiting play mode?

HotTag

Archive