Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post-processing CMD of the install command to accommodate redirection of results #52

Open
k-oizumi-abel opened this issue Aug 25, 2022 · 0 comments

Comments

@k-oizumi-abel
Copy link
Contributor

k-oizumi-abel commented Aug 25, 2022

">" is not recognized as a redirect sign.
The deno.run command probably treats ">" as a string.

Proposals:

First draft

  1. "> xxxx" and other parts are extracted using regular expressions to obtain the file name of the redirect destination
  2. Specify "piped" to stdout and stderr during deno.run to enable the program to handle standard output
  3. If a redirection was specified, Deno.writeFileSync saves the output to stdout

Pros

A single code can be used in a variety of environments.

Cons

Have to handle complex file names and redirects yourself. (>>, 2>>, 1>&2, etc.)

Second draft

If -p "cmd wc -c > /tmp/test.txt" is specified, start using /bin/sh as follows.

Deno.run({ cmd: ["/bin/sh", "-c", "wc -c data_files/xxx/xxx.zip > /tmp/test.txt"]})

Pros

/bin/sh handles redirects, so no need to implement your own processing.
If the function to send downloaded files as standard input is implemented, the string received with the -p option can be used as is.

Deno.run({ cmd: ["/bin/sh", "-c", "wc -c > /tmp/test.txt"], stdin: xxxx })

Cons

Need to change commands for each environment. (/bin/sh for Linux and Mac, cmd for Windows)

@k-oizumi-abel k-oizumi-abel changed the title Post-processing CMD of the installation command to accommodate redirection of results Post-processing CMD of the install command to accommodate redirection of results Aug 30, 2022
@k-oizumi-abel k-oizumi-abel changed the title Post-processing CMD of the install command to accommodate redirection of results Post-processing CMD of the install command, accommodate redirection of results Aug 30, 2022
@k-oizumi-abel k-oizumi-abel changed the title Post-processing CMD of the install command, accommodate redirection of results Post-processing CMD of the install command to accommodate redirection of results Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant