Giter Club home page Giter Club logo

Comments (12)

kennethreitz avatar kennethreitz commented on July 2, 2024

Correct. :)

from envoy.

kracekumar avatar kracekumar commented on July 2, 2024

so how to proceed ?

from envoy.

amoffat avatar amoffat commented on July 2, 2024

+1, this would be useful

from envoy.

kracekumar avatar kracekumar commented on July 2, 2024

Yes, let me crush my grey matter not now, after three days :)

Thanks & Regards

"Talk is cheap, show me the code" -- Linus Torvalds
kracekumar
www.kracekumar.com
*

from envoy.

kennethreitz avatar kennethreitz commented on July 2, 2024

I'm torn on this. I'm not sure how this would be very useful programmatically.

from envoy.

kracekumar avatar kracekumar commented on July 2, 2024

Since envoy is alternate to subprocess people tend to think envoy.run("let us shoot the command here"), since subprocess works fine with >> << people expect to try all sorts in envoy. We can parse the command and in case any one if them is present >,<,>>,<<, we will achieve the desired result using with and open if it is a file. I am not 100%sure this will work.

envoy rocks

if command is cat read.txt > write.txt

In [9]: with open('read.txt', 'r') as f:
    with open('write.txt', 'w') as w:
        w.writelines(f)
   ...:         

In [10]: cat write.txt
envoy rocks```

from envoy.

amoffat avatar amoffat commented on July 2, 2024

Programmatically, it's about as easy to redirect as it is to compose an initial function:

envoy.run("cat %s" % f1)
envoy.run("cat %s >> %s" % (f1,f2))

Granted "cat" is a bit contrived...the redirection does still save the extra keystrokes of opening a file with the appropriate mode, grabbing the stdout/stderr, and writing.

with open(f2, "a") as h: h.write(envoy.run("cat f1").std_out)

vs

envoy.run("cat f1 >> %s" % f2)

It feels more natural to use redirection in the command string. It would also seem consistent with the current API since piping is there.

Thoughts?

from envoy.

kracekumar avatar kracekumar commented on July 2, 2024

@amoffat : seems much better than the one i suggested. We can still think on it.

from envoy.

aljosa avatar aljosa commented on July 2, 2024

how about performance and compatibility?
i've run into this issue when i tried to do a pg_dump w/ envoy.run(), i know that "pg_dump ... > file.sql" works w/o problems for extremely large files.

will something like "with open(...) as h: h.write(envoy.run("pg_dump ...").std_out)" also work w/o problems?

from envoy.

kracekumar avatar kracekumar commented on July 2, 2024

examples

  1. nohup python test.py >> test.out &
  2. command | tee pipe.py

We might need to write own grammar, i feel pbs should be handly when compared to envoy, @kennethreitz what you say ?

from envoy.

xiongchiamiov avatar xiongchiamiov commented on July 2, 2024

Just ran into this. :/

Parsing shell commands is a tricky business, with a lot of subtle traps. But that's why I want a library to do it for me. ;)

from envoy.

kennethreitz avatar kennethreitz commented on July 2, 2024

This project is in a bit of a crisis state — it's really useful, and I use it on a daily basis. However, I wrote it in a few afternoons several years ago and haven't touched it since. In order to get the project into a stable state I'm closing all issues and pull requests

Don't take this as aggressive — it's just necessary for the project to make any progress any time soon (it's pretty clear the project is effectively unmaintained at the moment). Great things to come! Please watch the GitHub logs and feel free to re-open this discussion soon. I just need to really it into a good state first.

✨ ❤️ ✨

from envoy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.