import type { Session } from '../../../session/session.ts'; import type { DispatchFn } from '../../../../runtime/types.ts'; import type { Result } from '../types.ts'; /** * A diagnostic from a shell that never got as far as running. * * `prefix` and `command` come apart because bash reports itself by * `argv[0]`, which for a script operand is the operand: the recorded * command still has to be the builtin that ran, not a file path. */ export declare function scriptError(prefix: string, message: string, code: number, command?: string): Result; /** * Read a script file through the op dispatcher. * * Every way of running a script off a mount comes through here, so a backend * quirk is answered once rather than per caller. The one answered today is a * directory, which only a real filesystem reports as EISDIR on read: a keyed * backend has no directory object to open and answers ENOENT, ssh's raw error * carries no errno, and WebDAV serves the collection's HTML listing as bytes, * which a loader that read first would then run as a script. So the stat * probe runs before the read, and asks both channels a backend can answer on, * since on a prefix store a directory is the set of keys under it rather than * an object. A stat miss alone proves nothing (absence takes two channels), so * only a positive directory answer is acted on and the read still owns "no * such file". * * The caller owns the diagnostic: `source` and a nested shell word the same * failure differently and exit differently on it. */ export declare function readScriptText(dispatch: DispatchFn, path: string, cwd: string): Promise; /** * Read a script file operand, or the failure bash reports for it. * * GNU splits the diagnostics by how far startup got, and both halves fall out * of the errno rather than being listed case by case. A file the shell cannot * open at all is blamed on the shell, and only a missing one is exit 127 * (`bash: run.sh: No such file or directory`); anything it found but could not * run is 126 (`Permission denied`, `Not a directory`). A directory is the * exception, because it opens fine and fails on the first read, by which point * `$0` is already the operand, so bash prints it twice (`/tmp: /tmp: Is a * directory`, exit 126). Reproduced rather than tidied up: it is what an agent * copying a message into a search box will find. */ export declare function readScriptFile(dispatch: DispatchFn, name: string, path: string, session: Session): Promise<[string, null] | [null, Result]>; //# sourceMappingURL=script.d.ts.map