just-binary 3.3.0 → 3.3.1
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/bin/just-bash.js +279 -279
- package/dist/bin/shell/shell.js +270 -270
- package/dist/bundle/browser.js +390 -390
- package/dist/bundle/index.js +286 -286
- package/dist/interpreter/redirections.d.ts +11 -0
- package/dist/process/process-table.d.ts +14 -4
- package/dist/sandbox/Command.d.ts +7 -0
- package/package.json +1 -1
|
@@ -33,6 +33,17 @@ export declare function expandRedirectionTarget(ctx: InterpreterContext, redir:
|
|
|
33
33
|
*/
|
|
34
34
|
export declare function getInvalidRedirectTargetError(target: string): string | null;
|
|
35
35
|
export declare function getBadFileDescriptorError(fd: number): string;
|
|
36
|
+
/**
|
|
37
|
+
* Diagnostic for an input redirection whose target could not be read.
|
|
38
|
+
*
|
|
39
|
+
* bash distinguishes the reasons: `cat < missing` reports "No such file or
|
|
40
|
+
* directory" from the shell, while `cat < some-dir` opens the directory fine and
|
|
41
|
+
* the reader fails with "cat: stdin: Is a directory". Attributing it to the
|
|
42
|
+
* command needs provenance carried across lazy streams, which we do not have, so
|
|
43
|
+
* report the accurate reason under the shell's name rather than claiming a
|
|
44
|
+
* directory is missing.
|
|
45
|
+
*/
|
|
46
|
+
export declare function getInputRedirectionError(ctx: InterpreterContext, target: string): Promise<string>;
|
|
36
47
|
/**
|
|
37
48
|
* Allocate the next available file descriptor (starting at 10).
|
|
38
49
|
* Returns the allocated FD number.
|
|
@@ -35,6 +35,14 @@ export declare class ProcessTable {
|
|
|
35
35
|
private readonly jobs;
|
|
36
36
|
private readonly reapedWaitStatuses;
|
|
37
37
|
private readonly reapedWaitLineages;
|
|
38
|
+
/**
|
|
39
|
+
* Job numbers of reaped jobs, so `%n` still resolves right after the job dies.
|
|
40
|
+
* Real bash reaps asynchronously, so `kill %1; wait %1` resolves `%1` while
|
|
41
|
+
* `kill %1; sleep 0.3; wait %1` reports "no such job". We reap the instant the
|
|
42
|
+
* runner settles, which would lose that idiom; keeping the number mapping
|
|
43
|
+
* preserves it. Shares the wait-status lifecycle, so it is bounded the same way.
|
|
44
|
+
*/
|
|
45
|
+
private readonly reapedJobNumbers;
|
|
38
46
|
private readonly options;
|
|
39
47
|
private nextPid;
|
|
40
48
|
private nextLineageId;
|
|
@@ -52,8 +60,9 @@ export declare class ProcessTable {
|
|
|
52
60
|
start(command: string, runner: JobRunner, lineageId?: number): number;
|
|
53
61
|
list(): JobInfo[];
|
|
54
62
|
/**
|
|
55
|
-
* Snapshot jobs for the `jobs` builtin
|
|
56
|
-
*
|
|
63
|
+
* Snapshot jobs for the `jobs` builtin. Only live jobs are ever listed, since
|
|
64
|
+
* completed ones are reaped as they settle — a non-interactive bash likewise
|
|
65
|
+
* never lists a finished job. Markers are computed once for the whole table.
|
|
57
66
|
*/
|
|
58
67
|
listJobs(selectedPids?: ReadonlySet<number>, options?: ListJobsOptions): ListedJob[];
|
|
59
68
|
get(pid: number): JobInfo | undefined;
|
|
@@ -68,9 +77,9 @@ export declare class ProcessTable {
|
|
|
68
77
|
* every job in the table; shell builtins must use waitForLineage instead.
|
|
69
78
|
*/
|
|
70
79
|
wait(pid?: number): Promise<number>;
|
|
71
|
-
/** Wait for and reap only jobs launched by one
|
|
80
|
+
/** Wait for and reap only jobs launched by one shell's own execution. */
|
|
72
81
|
waitForLineage(lineageId: number): Promise<number>;
|
|
73
|
-
/** Allocate an identity
|
|
82
|
+
/** Allocate an identity shared by one shell's own in-process execution. */
|
|
74
83
|
createLineageId(): number;
|
|
75
84
|
abortAll(reason?: JobSignal): void;
|
|
76
85
|
dispose(): Promise<void>;
|
|
@@ -87,6 +96,7 @@ export declare class ProcessTable {
|
|
|
87
96
|
/** Report one output chunk. The table deliberately never retains it. */
|
|
88
97
|
observeOutput(pid: number, fd: number, chunk: Uint8Array): void;
|
|
89
98
|
private rememberWaitStatus;
|
|
99
|
+
private forgetWaitStatus;
|
|
90
100
|
private deleteJobs;
|
|
91
101
|
}
|
|
92
102
|
export {};
|
|
@@ -21,12 +21,19 @@ export declare class Command {
|
|
|
21
21
|
private processes;
|
|
22
22
|
private shellProcesses;
|
|
23
23
|
private logMessages;
|
|
24
|
+
private retainedLogBytes;
|
|
25
|
+
private droppedLogMessages;
|
|
24
26
|
private logReaders;
|
|
25
27
|
private logsComplete;
|
|
26
28
|
private stdoutDecoder;
|
|
27
29
|
private stderrDecoder;
|
|
28
30
|
private resultPromise;
|
|
29
31
|
constructor(bashEnv: Bash, cmdLine: string, cwd: string, env?: Record<string, string>, explicitCwd?: boolean, processes?: ProcessTable, shellProcesses?: ProcessTable);
|
|
32
|
+
/**
|
|
33
|
+
* Resolve with the signal's exit status once cancellation is requested, using
|
|
34
|
+
* the output collected so far. Never rejects, so it can lose a race safely.
|
|
35
|
+
*/
|
|
36
|
+
private resultOnAbort;
|
|
30
37
|
private appendLog;
|
|
31
38
|
private execute;
|
|
32
39
|
logs(): AsyncGenerator<OutputMessage, void, unknown>;
|