stream the output dynamically
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: Sam Therapy <sam@samtherapy.net>
This commit is contained in:
parent
2082460f81
commit
feab29e592
2 changed files with 8 additions and 12 deletions
|
@ -4,7 +4,7 @@ FROM denoland/deno:1.28.3 as base
|
|||
RUN deno install --allow-read --allow-write --allow-env --allow-net --allow-run --no-check -r -f https://deno.land/x/deploy/deployctl.ts
|
||||
|
||||
COPY run.ts /bin/
|
||||
RUN chmod +x /bin/run.ts
|
||||
RUN chmod +x /bin/run.ts && deno cache /bin/run.ts
|
||||
|
||||
USER deno
|
||||
CMD ["/bin/run.ts"]
|
||||
|
|
18
run.ts
18
run.ts
|
@ -1,5 +1,7 @@
|
|||
#!/usr/bin/env -S deno run --allow-run --allow-env --no-lock
|
||||
|
||||
import { copy } from "https://deno.land/std@0.104.0/io/util.ts";
|
||||
|
||||
const env = Deno.env.toObject();
|
||||
|
||||
if (!env["PLUGIN_DENO_DEPLOY_TOKEN"] && !env["DENO_DEPLOY_TOKEN"]) {
|
||||
|
@ -63,20 +65,14 @@ const prog = Deno.run({
|
|||
});
|
||||
|
||||
// TODO: make this dynamic?
|
||||
const [status, stdout, stderr] = await Promise.all([
|
||||
prog.status(),
|
||||
prog.output(),
|
||||
prog.stderrOutput(),
|
||||
]);
|
||||
const status = await prog.status()
|
||||
|
||||
copy(prog.stdout, Deno.stdout);
|
||||
copy(prog.stderr, Deno.stderr);
|
||||
|
||||
prog.close();
|
||||
|
||||
const std = new TextDecoder().decode(stdout);
|
||||
const err = new TextDecoder().decode(stderr);
|
||||
|
||||
console.log(std);
|
||||
|
||||
if (!status.success) {
|
||||
console.error("Deno Deploy failed!");
|
||||
console.log(err);
|
||||
Deno.exit(1);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue