Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions ports/dup_test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//! Test port to produce duplicate exec basenames without env var conflicts

import type {
DownloadArgs,
InstallArgs,
InstallConfigSimple,
} from "../src/deno_ports/mod.ts";
import {
$,
ALL_ARCH,
ALL_OS,
osXarch,
PortBase,
zod,
} from "../src/deno_ports/mod.ts";
import { std_fs } from "../src/deno_utils/mod.ts";

const manifest = {
ty: "denoWorker@v1" as const,
name: "dup_test",
version: "0.1.0",
moduleSpecifier: import.meta.url,
platforms: osXarch([...ALL_OS], [...ALL_ARCH]),
};

const confValidator = zod.object({
output: zod.string(),
});

export type DupTestInstallConf =
& InstallConfigSimple
& zod.infer<typeof confValidator>;

export default function conf(config: DupTestInstallConf) {
return {
...config,
port: manifest,
};
}

export class Port extends PortBase {
override execEnv() {
// no env vars to avoid conflicts across multiple installs
return {};
}

listAll() {
return ["dup_test"];
}

override async download(args: DownloadArgs) {
const conf = confValidator.parse(args.config);
await $.path(args.downloadPath).join("bin", "dup").writeText(
`#!/bin/sh\necho ${conf.output}`,
{ mode: 0o700 },
);
}

override async install(args: InstallArgs) {
const installPath = $.path(args.installPath);
await $.removeIfExists(installPath);
await std_fs.copy(args.downloadPath, args.installPath);
}
}
1 change: 1 addition & 0 deletions src/deno_utils/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
zod,
zod_val_err,
} from "./deps.ts";
export { std_fs } from "./deps.ts";
import logger, { isColorfulTty } from "./logger.ts";
// NOTE: only use type imports only when getting stuff from "./sys_deno"
import type { OsEnum } from "../sys_deno/ports/types.ts";
Expand Down
3 changes: 2 additions & 1 deletion src/ghjk/systems/envs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,8 @@ pub async fn reduce_and_cook_to(
let env_vars = posix::cook(
ecx,
&reduced_recipe,
env_name.unwrap_or(env_key),
env_key,
env_name,
env_dir,
create_shell_loaders,
)
Expand Down
Loading
Loading