DNAD
Denoβ€’3y agoβ€’
7 replies
DNA

Deno.Command not working for application

Hello. Im trying to start an application using Deno.Command, but it for some reason doesnt work. The path itself functions normally even from powershell.

// Get the application to start
const application = body.application?.trim()?.replace(/\\/g, "/");
if (!application) return new Response(JSON.stringify({message: "error", error: "noApplication"}), {status: Status.BadRequest, headers: {"Content-Type": "text/json"}});

// If there is a space in the application, surround it with quotes
console.log(application);

const command = new Deno.Command(`${application}`, {stdin: "null"});

// Return the user the code and the time it took to execute
const start = performance.now();
const results = await command.output();
const end = performance.now();

return new Response(JSON.stringify({message: "success", code: results.code, time: end - start}), {status: Status.OK, headers: {"Content-Type": "text/json"}});
image.png
image.png
Was this page helpful?