温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/reference/node/util/convertProcessSignalToExitCode
点击访问原文链接

Node util.convertProcessSignalToExitCode function | API Reference | Bun

Node util.convertProcessSignalToExitCode function | API Reference | BunBuildDocsReferenceGuidesBlogDiscord/node:util/convertProcessSignalToExitCodeFconvertProcessSignalToExitCode

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/node:util/convertProcessSignalToExitCodeFconvertProcessSignalToExitCode

function

util.convertProcessSignalToExitCodefunction convertProcessSignalToExitCode(signal: Signals): number;

The util.convertProcessSignalToExitCode() method converts a signal name to its corresponding POSIX exit code. Following the POSIX standard, the exit code for a process terminated by a signal is calculated as 128 + signal number.

If signal is not a valid signal name, then an error will be thrown. See signal(7) for a list of valid signals.

import { convertProcessSignalToExitCode } from 'node:util';

console.log(convertProcessSignalToExitCode('SIGTERM')); // 143 (128 + 15)
console.log(convertProcessSignalToExitCode('SIGKILL')); // 137 (128 + 9)

This is particularly useful when working with processes to determine the exit code based on the signal that terminated the process.

@param signal

A signal name (e.g. 'SIGTERM')

@returns

The exit code corresponding to signal

Resources

ReferenceDocsGuidesDiscordMerch StoreGitHubBlog 

Toolkit

RuntimePackage managerTest runnerBundlerPackage runner

Project

Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicense

Baked with ❤️ in San Francisco

We're hiring →

Node util.convertProcessSignalToExitCode function | API Reference | Bun,AI智能索引,全网链接索引,智能导航,网页索引

    API documentation for function node:util.convertProcessSignalToExitCode | Bun