Skip to content

Commit

Permalink
fix(core): check if signal defined before usage in process.kill
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder committed Jan 17, 2025
1 parent 476239d commit 78836c3
Show file tree
Hide file tree
Showing 6 changed files with 164 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/generated/devkit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ It only uses language primitives and immutable objects
### Classes

- [AggregateCreateNodesError](../../devkit/documents/AggregateCreateNodesError)
- [StaleProjectGraphCacheError](../../devkit/documents/StaleProjectGraphCacheError)

### Interfaces

Expand Down
144 changes: 144 additions & 0 deletions docs/generated/devkit/StaleProjectGraphCacheError.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# Class: StaleProjectGraphCacheError

## Hierarchy

- `Error`

**`StaleProjectGraphCacheError`**

## Table of contents

### Constructors

- [constructor](../../devkit/documents/StaleProjectGraphCacheError#constructor)

### Properties

- [cause](../../devkit/documents/StaleProjectGraphCacheError#cause): unknown
- [message](../../devkit/documents/StaleProjectGraphCacheError#message): string
- [name](../../devkit/documents/StaleProjectGraphCacheError#name): string
- [stack](../../devkit/documents/StaleProjectGraphCacheError#stack): string
- [prepareStackTrace](../../devkit/documents/StaleProjectGraphCacheError#preparestacktrace): Function
- [stackTraceLimit](../../devkit/documents/StaleProjectGraphCacheError#stacktracelimit): number

### Methods

- [captureStackTrace](../../devkit/documents/StaleProjectGraphCacheError#capturestacktrace)

## Constructors

### constructor

**new StaleProjectGraphCacheError**(): [`StaleProjectGraphCacheError`](../../devkit/documents/StaleProjectGraphCacheError)

#### Returns

[`StaleProjectGraphCacheError`](../../devkit/documents/StaleProjectGraphCacheError)

#### Overrides

Error.constructor

## Properties

### cause

`Optional` **cause**: `unknown`

#### Inherited from

Error.cause

---

### message

**message**: `string`

#### Inherited from

Error.message

---

### name

**name**: `string`

#### Inherited from

Error.name

---

### stack

`Optional` **stack**: `string`

#### Inherited from

Error.stack

---

### prepareStackTrace

`Static` `Optional` **prepareStackTrace**: (`err`: `Error`, `stackTraces`: `CallSite`[]) => `any`

Optional override for formatting stack traces

**`See`**

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

#### Type declaration

▸ (`err`, `stackTraces`): `any`

##### Parameters

| Name | Type |
| :------------ | :----------- |
| `err` | `Error` |
| `stackTraces` | `CallSite`[] |

##### Returns

`any`

#### Inherited from

Error.prepareStackTrace

---

### stackTraceLimit

`Static` **stackTraceLimit**: `number`

#### Inherited from

Error.stackTraceLimit

## Methods

### captureStackTrace

**captureStackTrace**(`targetObject`, `constructorOpt?`): `void`

Create .stack property on a target object

#### Parameters

| Name | Type |
| :---------------- | :--------- |
| `targetObject` | `object` |
| `constructorOpt?` | `Function` |

#### Returns

`void`

#### Inherited from

Error.captureStackTrace
10 changes: 8 additions & 2 deletions docs/generated/devkit/readCachedProjectGraph.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# Function: readCachedProjectGraph

**readCachedProjectGraph**(): [`ProjectGraph`](../../devkit/documents/ProjectGraph) & \{ `computedAt`: `number` ; `errors`: `ProjectGraphErrorTypes`[] }
**readCachedProjectGraph**(`minimumComputedAt?`): [`ProjectGraph`](../../devkit/documents/ProjectGraph)

Synchronously reads the latest cached copy of the workspace's ProjectGraph.

#### Parameters

| Name | Type | Description |
| :------------------- | :------- | :----------------------------------------------------------------------------- |
| `minimumComputedAt?` | `number` | The minimum timestamp that the cached ProjectGraph must have been computed at. |

#### Returns

[`ProjectGraph`](../../devkit/documents/ProjectGraph) & \{ `computedAt`: `number` ; `errors`: `ProjectGraphErrorTypes`[] }
[`ProjectGraph`](../../devkit/documents/ProjectGraph)

**`Throws`**

Expand Down
1 change: 1 addition & 0 deletions docs/generated/packages/devkit/documents/nx_devkit.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ It only uses language primitives and immutable objects
### Classes

- [AggregateCreateNodesError](../../devkit/documents/AggregateCreateNodesError)
- [StaleProjectGraphCacheError](../../devkit/documents/StaleProjectGraphCacheError)

### Interfaces

Expand Down
6 changes: 5 additions & 1 deletion packages/nx/src/executors/run-commands/run-commands.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,11 @@ function registerProcessListener() {
registerCleanupFn((signal) => {
childProcesses.forEach((p) => {
if ('connected' in p ? p.connected : p.isAlive) {
p.kill(signal);
if (signal) {
p.kill(signal);
} else {
p.kill();
}
}
});
});
Expand Down
6 changes: 5 additions & 1 deletion packages/nx/src/tasks-runner/forked-process-task-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,11 @@ export class ForkedProcessTaskRunner {
registerCleanupFn((signal) => {
this.processes.forEach((p) => {
if ('connected' in p ? p.connected : p.isAlive) {
p.kill(signal);
if (signal) {
p.kill(signal);
} else {
p.kill();
}
}
});
});
Expand Down

0 comments on commit 78836c3

Please sign in to comment.