-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmock.ts
More file actions
25 lines (17 loc) · 677 Bytes
/
Copy pathmock.ts
File metadata and controls
25 lines (17 loc) · 677 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Isomorphic bazx implementation that never runs a command (always throw).
// Intended to be used along with middlewares.
/// <reference path="./deno.d.ts" />
export * from './mod.ts'
import type { BazxExec, BazxOptions } from './mod.ts';
import { createBazx } from './mod.ts';
export const exec: BazxExec = async function exec(cmd, { stdin, stdout, stderr } = {}) {
await Promise.all([
stdin?.cancel(),
stdout?.getWriter().close(),
stderr?.getWriter().close()
]);
throw new Error(`${cmd[0]}: command not found`); // FIXME Return code 0 instead?
}
export const options: BazxOptions = {};
export const $ = createBazx(exec, options);
export default $;