@orkestrel/process 0.0.14 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/core/index.cjs +46 -21
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +14 -14
- package/dist/src/core/index.d.ts +14 -14
- package/dist/src/core/index.js +47 -22
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +345 -314
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +23 -9
- package/dist/src/server/index.d.ts +23 -9
- package/dist/src/server/index.js +345 -315
- package/dist/src/server/index.js.map +1 -1
- package/package.json +16 -16
|
@@ -309,6 +309,20 @@ export declare function executeSync(command: ProcessCommand, options?: ExecuteSy
|
|
|
309
309
|
*/
|
|
310
310
|
export declare function formatCommand(command: ProcessCommand): string;
|
|
311
311
|
|
|
312
|
+
/**
|
|
313
|
+
* Reports whether a process or POSIX process group still exists.
|
|
314
|
+
*
|
|
315
|
+
* @param pid - A positive process id, or a negative POSIX process-group id
|
|
316
|
+
* @returns True when the host confirms existence or refuses permission; false for ESRCH; undefined for another host failure
|
|
317
|
+
* @throws A {@link ProcessError} coded `invalid` for an unsafe integer, zero, minus one, or a negative id on Windows
|
|
318
|
+
* @remarks Negative ids probe POSIX process groups. The `process.platform` branch refuses negative ids on Windows, where the host supports positive process ids only.
|
|
319
|
+
* @example
|
|
320
|
+
* ```ts
|
|
321
|
+
* inspectProcess(process.pid) // true
|
|
322
|
+
* ```
|
|
323
|
+
*/
|
|
324
|
+
export declare function inspectProcess(pid: number): boolean | undefined;
|
|
325
|
+
|
|
312
326
|
/**
|
|
313
327
|
* Checks whether a child process has reached its native exit.
|
|
314
328
|
*
|
|
@@ -482,7 +496,7 @@ export declare class Process implements ProcessInterface {
|
|
|
482
496
|
/** Reports whether the terminal moment arrived and `exit` settled. */
|
|
483
497
|
get settled(): boolean;
|
|
484
498
|
/** Reports whether termination began, including after the terminal moment. */
|
|
485
|
-
get
|
|
499
|
+
get terminated(): boolean;
|
|
486
500
|
/** Settles with the terminal child state, observed once after stream close or the drain cutoff. */
|
|
487
501
|
get exit(): Promise<ProcessExit>;
|
|
488
502
|
/**
|
|
@@ -791,7 +805,7 @@ export declare function resolveExecutable(file: string, options?: ExecutableOpti
|
|
|
791
805
|
*
|
|
792
806
|
* The standard-input channel is open from the spawn, and `end` closes it without terminating
|
|
793
807
|
* anything. That is the member a cooperative protocol reaches for: the child observes end of input
|
|
794
|
-
* and exits on its own, which `
|
|
808
|
+
* and exits on its own, which `ended` reports. `stop` and `destroy` remain the terminations, and
|
|
795
809
|
* `exit` remains the terminal moment — the native exit plus at most `drain` while a descendant holds
|
|
796
810
|
* the inherited read ends.
|
|
797
811
|
*
|
|
@@ -827,9 +841,9 @@ export declare class Session implements SessionInterface {
|
|
|
827
841
|
/** Reports whether the terminal moment arrived and `exit` settled. */
|
|
828
842
|
get settled(): boolean;
|
|
829
843
|
/** Reports whether termination began, including after the terminal moment. `end` never turns it true. */
|
|
830
|
-
get
|
|
844
|
+
get terminated(): boolean;
|
|
831
845
|
/** Settles at the child's own ending, awaited without the terminal moment's drain window. */
|
|
832
|
-
get
|
|
846
|
+
get ended(): Promise<void>;
|
|
833
847
|
/** Settles with the terminal child state, observed once after stream close or the drain cutoff. */
|
|
834
848
|
get exit(): Promise<ProcessExit>;
|
|
835
849
|
/**
|
|
@@ -849,7 +863,7 @@ export declare class Session implements SessionInterface {
|
|
|
849
863
|
* Closes the standard-input channel and leaves the child running.
|
|
850
864
|
*
|
|
851
865
|
* @remarks
|
|
852
|
-
* Never rejects and terminates nothing: `
|
|
866
|
+
* Never rejects and terminates nothing: `terminated` stays false and the terminal moment does not
|
|
853
867
|
* arrive. Every call shares one barrier, which resolves after the host flushes the writes it had
|
|
854
868
|
* already accepted. A later `write` resolves `false`.
|
|
855
869
|
*
|
|
@@ -936,7 +950,7 @@ export declare function stopChild(child: ProcessChildInterface, grace: number, c
|
|
|
936
950
|
* emitter and event map its consumers subscribe to.
|
|
937
951
|
*
|
|
938
952
|
* The child's ending and the supervision's ending are distinct. `pid`, `code`, and `signal` read the
|
|
939
|
-
* host child directly, so they expose native exit as soon as the host records it, and `
|
|
953
|
+
* host child directly, so they expose native exit as soon as the host records it, and `ended`
|
|
940
954
|
* settles at that same moment. `settled`, `exit`, and `evidence` reach one terminal moment after the
|
|
941
955
|
* read channels close or the bounded `drain` window cuts them off. That window is armed by the
|
|
942
956
|
* child's native exit and by a termination this package initiated, so every way a child can end
|
|
@@ -1002,7 +1016,7 @@ export declare class Supervisor {
|
|
|
1002
1016
|
/** Reports whether the terminal moment arrived and `exit` settled. */
|
|
1003
1017
|
get settled(): boolean;
|
|
1004
1018
|
/** Reports whether termination began, including after the terminal moment. */
|
|
1005
|
-
get
|
|
1019
|
+
get terminated(): boolean;
|
|
1006
1020
|
/**
|
|
1007
1021
|
* Settles at the child's own ending, awaited without the terminal moment's drain window.
|
|
1008
1022
|
*
|
|
@@ -1011,7 +1025,7 @@ export declare class Supervisor {
|
|
|
1011
1025
|
* the host records them. It settles at the native exit, and at the terminal moment for a child
|
|
1012
1026
|
* whose spawn produced no native exit at all, so it can never outlive the supervision.
|
|
1013
1027
|
*/
|
|
1014
|
-
get
|
|
1028
|
+
get ended(): Promise<void>;
|
|
1015
1029
|
/** Settles with the terminal child state, observed once after stream close or the drain cutoff. */
|
|
1016
1030
|
get exit(): Promise<ProcessExit>;
|
|
1017
1031
|
/**
|
|
@@ -1057,7 +1071,7 @@ export declare class Supervisor {
|
|
|
1057
1071
|
* Closes the standard-input channel while leaving the child running.
|
|
1058
1072
|
*
|
|
1059
1073
|
* @remarks
|
|
1060
|
-
* Never rejects, and terminates nothing: no signal is sent, `
|
|
1074
|
+
* Never rejects, and terminates nothing: no signal is sent, `terminated` stays false, no drain
|
|
1061
1075
|
* window is armed, and the terminal moment does not arrive. The child observes end of input and
|
|
1062
1076
|
* decides for itself what to do about it, which is what separates this from `stop`.
|
|
1063
1077
|
*
|
|
@@ -309,6 +309,20 @@ export declare function executeSync(command: ProcessCommand, options?: ExecuteSy
|
|
|
309
309
|
*/
|
|
310
310
|
export declare function formatCommand(command: ProcessCommand): string;
|
|
311
311
|
|
|
312
|
+
/**
|
|
313
|
+
* Reports whether a process or POSIX process group still exists.
|
|
314
|
+
*
|
|
315
|
+
* @param pid - A positive process id, or a negative POSIX process-group id
|
|
316
|
+
* @returns True when the host confirms existence or refuses permission; false for ESRCH; undefined for another host failure
|
|
317
|
+
* @throws A {@link ProcessError} coded `invalid` for an unsafe integer, zero, minus one, or a negative id on Windows
|
|
318
|
+
* @remarks Negative ids probe POSIX process groups. The `process.platform` branch refuses negative ids on Windows, where the host supports positive process ids only.
|
|
319
|
+
* @example
|
|
320
|
+
* ```ts
|
|
321
|
+
* inspectProcess(process.pid) // true
|
|
322
|
+
* ```
|
|
323
|
+
*/
|
|
324
|
+
export declare function inspectProcess(pid: number): boolean | undefined;
|
|
325
|
+
|
|
312
326
|
/**
|
|
313
327
|
* Checks whether a child process has reached its native exit.
|
|
314
328
|
*
|
|
@@ -482,7 +496,7 @@ export declare class Process implements ProcessInterface {
|
|
|
482
496
|
/** Reports whether the terminal moment arrived and `exit` settled. */
|
|
483
497
|
get settled(): boolean;
|
|
484
498
|
/** Reports whether termination began, including after the terminal moment. */
|
|
485
|
-
get
|
|
499
|
+
get terminated(): boolean;
|
|
486
500
|
/** Settles with the terminal child state, observed once after stream close or the drain cutoff. */
|
|
487
501
|
get exit(): Promise<ProcessExit>;
|
|
488
502
|
/**
|
|
@@ -791,7 +805,7 @@ export declare function resolveExecutable(file: string, options?: ExecutableOpti
|
|
|
791
805
|
*
|
|
792
806
|
* The standard-input channel is open from the spawn, and `end` closes it without terminating
|
|
793
807
|
* anything. That is the member a cooperative protocol reaches for: the child observes end of input
|
|
794
|
-
* and exits on its own, which `
|
|
808
|
+
* and exits on its own, which `ended` reports. `stop` and `destroy` remain the terminations, and
|
|
795
809
|
* `exit` remains the terminal moment — the native exit plus at most `drain` while a descendant holds
|
|
796
810
|
* the inherited read ends.
|
|
797
811
|
*
|
|
@@ -827,9 +841,9 @@ export declare class Session implements SessionInterface {
|
|
|
827
841
|
/** Reports whether the terminal moment arrived and `exit` settled. */
|
|
828
842
|
get settled(): boolean;
|
|
829
843
|
/** Reports whether termination began, including after the terminal moment. `end` never turns it true. */
|
|
830
|
-
get
|
|
844
|
+
get terminated(): boolean;
|
|
831
845
|
/** Settles at the child's own ending, awaited without the terminal moment's drain window. */
|
|
832
|
-
get
|
|
846
|
+
get ended(): Promise<void>;
|
|
833
847
|
/** Settles with the terminal child state, observed once after stream close or the drain cutoff. */
|
|
834
848
|
get exit(): Promise<ProcessExit>;
|
|
835
849
|
/**
|
|
@@ -849,7 +863,7 @@ export declare class Session implements SessionInterface {
|
|
|
849
863
|
* Closes the standard-input channel and leaves the child running.
|
|
850
864
|
*
|
|
851
865
|
* @remarks
|
|
852
|
-
* Never rejects and terminates nothing: `
|
|
866
|
+
* Never rejects and terminates nothing: `terminated` stays false and the terminal moment does not
|
|
853
867
|
* arrive. Every call shares one barrier, which resolves after the host flushes the writes it had
|
|
854
868
|
* already accepted. A later `write` resolves `false`.
|
|
855
869
|
*
|
|
@@ -936,7 +950,7 @@ export declare function stopChild(child: ProcessChildInterface, grace: number, c
|
|
|
936
950
|
* emitter and event map its consumers subscribe to.
|
|
937
951
|
*
|
|
938
952
|
* The child's ending and the supervision's ending are distinct. `pid`, `code`, and `signal` read the
|
|
939
|
-
* host child directly, so they expose native exit as soon as the host records it, and `
|
|
953
|
+
* host child directly, so they expose native exit as soon as the host records it, and `ended`
|
|
940
954
|
* settles at that same moment. `settled`, `exit`, and `evidence` reach one terminal moment after the
|
|
941
955
|
* read channels close or the bounded `drain` window cuts them off. That window is armed by the
|
|
942
956
|
* child's native exit and by a termination this package initiated, so every way a child can end
|
|
@@ -1002,7 +1016,7 @@ export declare class Supervisor {
|
|
|
1002
1016
|
/** Reports whether the terminal moment arrived and `exit` settled. */
|
|
1003
1017
|
get settled(): boolean;
|
|
1004
1018
|
/** Reports whether termination began, including after the terminal moment. */
|
|
1005
|
-
get
|
|
1019
|
+
get terminated(): boolean;
|
|
1006
1020
|
/**
|
|
1007
1021
|
* Settles at the child's own ending, awaited without the terminal moment's drain window.
|
|
1008
1022
|
*
|
|
@@ -1011,7 +1025,7 @@ export declare class Supervisor {
|
|
|
1011
1025
|
* the host records them. It settles at the native exit, and at the terminal moment for a child
|
|
1012
1026
|
* whose spawn produced no native exit at all, so it can never outlive the supervision.
|
|
1013
1027
|
*/
|
|
1014
|
-
get
|
|
1028
|
+
get ended(): Promise<void>;
|
|
1015
1029
|
/** Settles with the terminal child state, observed once after stream close or the drain cutoff. */
|
|
1016
1030
|
get exit(): Promise<ProcessExit>;
|
|
1017
1031
|
/**
|
|
@@ -1057,7 +1071,7 @@ export declare class Supervisor {
|
|
|
1057
1071
|
* Closes the standard-input channel while leaving the child running.
|
|
1058
1072
|
*
|
|
1059
1073
|
* @remarks
|
|
1060
|
-
* Never rejects, and terminates nothing: no signal is sent, `
|
|
1074
|
+
* Never rejects, and terminates nothing: no signal is sent, `terminated` stays false, no drain
|
|
1061
1075
|
* window is armed, and the terminal moment does not arrive. The child observes end of input and
|
|
1062
1076
|
* decides for itself what to do about it, which is what separates this from `stop`.
|
|
1063
1077
|
*
|