Replies: 3 comments 5 replies
-
|
demo: // git commit
const res = Deno.run({
cmd: ['git', 'commit', '-a', '-m', str],
stdout: 'piped',
stderr: 'piped',
});
const commitMsg = new TextDecoder('utf-8').decode(await res.output());
const errMsg = new TextDecoder('utf-8').decode(await res.stderrOutput());
console.log({ commitMsg, errMsg }); |
Beta Was this translation helpful? Give feedback.
-
|
I think what you are doing is platform dependent in a way that it makes sense for you to handle each OS manually. You don't need to create versions of your app or library tied to a platform, just add some logic to support all platforms. I don't think automatically finding the location of binaries in various platforms is in scope for Deno built-in API. Deno API's are somewhat low level, higher level stuff like this can, and arguably should, be handled by external modules. It is something that could possibly be a useful third-party module, or maybe even std module. It is a legitimate feature request. No need to get oneself worked up on it getting moved to a discussion :) I'm a bit rusty with linux so not exactly sure what would be the equivalents in linux/darwin. Just a "/usr/bin/" + command has worked for my use cases, which are not many, though. |
Beta Was this translation helpful? Give feedback.
-
|
Could you try running with |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to build a simple CLI tool to run dev scripts with Deno. The goal is to create cross-platform scripts with type safety.
I'm not succeeding with Deno.run(). I think this is due to part of my scripts are based on global packages installed with NPM like, for example, the firebase CLI tool.
If i run something like this:
I get this error
I found some clarification in this issue about echo. But, I'm afraid if I prefix everything with
"cmd", "/c",the program will tie itself to the OS. Is this a valid assumption?Is there another API that enables us to run commands through the current shell instead of attempt to find binaries in the system directly?
I think in node this is done with something like this:
Thanks for the awesome tool.
JM
Beta Was this translation helpful? Give feedback.
All reactions