Coder Social home page Coder Social logo

ehmicky / human-signals Goto Github PK

View Code? Open in Web Editor NEW
271.0 2.0 8.0 9.45 MB

Human-friendly process signals

License: Apache License 2.0

JavaScript 90.59% TypeScript 9.41%
signal signals handlers error-handling interrupts sigterm sigint irq process exit

human-signals's Introduction

Node TypeScript Codecov Mastodon Medium

Human-friendly process signals.

This is a map of known process signals with some information about each signal.

Unlike os.constants.signals this includes:

Hire me

Please reach out if you're looking for a Node.js API or CLI engineer (11 years of experience). Most recently I have been Netlify Build's and Netlify Plugins' technical lead for 2.5 years. I am available for full-time remote positions.

Example

import { signalsByName, signalsByNumber } from 'human-signals'

console.log(signalsByName.SIGINT)
// {
//   name: 'SIGINT',
//   number: 2,
//   description: 'User interruption with CTRL-C',
//   supported: true,
//   action: 'terminate',
//   forced: false,
//   standard: 'ansi'
// }

console.log(signalsByNumber[8])
// {
//   name: 'SIGFPE',
//   number: 8,
//   description: 'Floating point arithmetic error',
//   supported: true,
//   action: 'core',
//   forced: false,
//   standard: 'ansi'
// }

Install

npm install human-signals

This package works in Node.js >=18.18.0.

This is an ES module. It must be loaded using an import or import() statement, not require(). If TypeScript is used, it must be configured to output ES modules, not CommonJS.

Usage

signalsByName

Type: object

Object whose keys are signal names and values are signal objects.

signalsByNumber

Type: object

Object whose keys are signal numbers and values are signal objects.

signal

Type: object

Signal object with the following properties.

name

Type: string

Standard name of the signal, for example 'SIGINT'.

number

Type: number

Code number of the signal, for example 2. While most number are cross-platform, some are different between different OS.

description

Type: string

Human-friendly description for the signal, for example 'User interruption with CTRL-C'.

supported

Type: boolean

Whether the current OS can handle this signal in Node.js using process.on(name, handler).

The list of supported signals is OS-specific.

action

Type: string
Enum: 'terminate', 'core', 'ignore', 'pause', 'unpause'

What is the default action for this signal when it is not handled.

forced

Type: boolean

Whether the signal's default action cannot be prevented. This is true for SIGTERM, SIGKILL and SIGSTOP.

standard

Type: string
Enum: 'ansi', 'posix', 'bsd', 'systemv', 'other'

Which standard defined that signal.

Support

For any question, don't hesitate to submit an issue on GitHub.

Everyone is welcome regardless of personal background. We enforce a Code of conduct in order to promote a positive and inclusive environment.

Contributing

This project was made with โค๏ธ. The simplest way to give back is by starring and sharing it online.

If the documentation is unclear or has a typo, please click on the page's Edit button (pencil icon) and suggest a correction.

If you would like to help us fix a bug or add a new feature, please check our guidelines. Pull requests are welcome!

Thanks go to our wonderful contributors:


ehmicky

๐Ÿ’ป ๐ŸŽจ ๐Ÿค” ๐Ÿ“–

electrovir

๐Ÿ’ป

human-signals's People

Contributors

allcontributors[bot] avatar dependabot[bot] avatar ehmicky avatar electrovir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

human-signals's Issues

Question about the examples - SIGTERM vs SIGINT

From the examples:

console.log(signalsByName.SIGTERM)
// {
//   name: 'SIGINT',
//   number: 2,
//   description: 'User interruption with CTRL-C',
//   supported: true,
//   action: 'terminate',
//   forced: false,
//   standard: 'ansi'
// }

Why is signalsByName.SIGTERM.name === "SIGINT"? This is surprising to me...


By the way thanks for the great work on all your repositories :) I really like your work.

remove the useless sourcemap url in file end

Guidelines

  • Please search other issues to make sure this bug has not already been reported.
  • If this is related to a typo or the documentation being unclear, please click on the relevant page's Edit button (pencil icon) and suggest a correction instead.

Describe the bug

image

Steps to reproduce

just install the module and open build/src/core.js file, check the file end

Configuration

no

Environment

System:
OS: macOS 13.2.1
CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
Memory: 157.75 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.15.0 - ~/Library/Caches/fnm_multishells/5372_1679169655890/bin/node
Yarn: 1.22.19 - ~/Library/Caches/fnm_multishells/5372_1679169655890/bin/yarn
npm: 9.6.2 - ~/Library/Caches/fnm_multishells/5372_1679169655890/bin/npm
Browsers:
Chrome: 111.0.5563.64
Chrome Canary: 113.0.5660.0
Firefox: 109.0.1
Firefox Developer Edition: 111.0
Safari: 16.3

Pull request (optional)

  • I can submit a pull request.

Cannot destructure property 'signals' of '_os.constants' as it is undefined.

Guidelines

  • Please search other issues to make sure this bug has not already been reported.
  • If this is related to a typo or the documentation being unclear, please click on the relevant page's Edit button (pencil icon) and suggest a correction instead.

Describe the bug

image
When trying to run cypress I get this error. but the problem is generated where the image shows

Steps to reproduce

Cypress v13.2.0 is installed
a simple test case is created
and it runs and the error is shown

Configuration

I don't know

Environment

I don't know

Pull request (optional)

  • I can submit a pull request.

Add typings for imports in Typescript

Getting a Could not find a declaration file for module 'human-signals'. when importing this in Typescript, such as in the following:

import {signalsByName} from 'human-signals';

Also @types/human-signals does not exist in npm.

Happy to assist if needed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.