Coder Social home page Coder Social logo

Comments (2)

vamega avatar vamega commented on July 30, 2024

I read through the implementation of sys_command but I'm unable to grasp what the emulate option is supposed to do. Would you mind explaining what it's purpose is?

from archinstall.

Torxed avatar Torxed commented on July 30, 2024

Correct, there is a history behind this.
sys_command() was considered a very transparent execution class/function for system commands.
I designed it so that it would be able to take anything, but only execute a subset of parameters.

For instance,

archinstall.luks(partition="/dev/sda2", mountpoint="/mnt", password="xyz", emulate=True)

Would in theory make the sys_command() emulate the command.
Which perhaps answers the second question, what emulate does. I used to throughout the development phase to emulate the execution chain, like a unit tests. And to some extent did up until very recently. It was a pretty quick and efficient way to make sure command calls (even on abstract archinstall level) never actually got executed (potentially ruining my harddrive if I tested things "on the go").

So that's the back story. Now to the future plans.
You've manage to find the functionality I'm probably least proud of hehe. And it should be re-worked a bit.
Especially the __iter__ function, I thought it was a nice thing because I could use it with string manpulation and stuff. But I've realized that the best way forward would probably be just a standard .output() or something which builds/joins the results together. It was also there for this purpose:

for line in sys_command("ls -l"):
    print(line)

Which was nice for debug outputs and stuff. But I don't think we need that anymore.
I would need to consider the nature of sys_command's diffuse parameter-requirement a bit, but as long as the function calls before sys_command takes *args and **kwargs I don't see a problem making sys_command taking more strict parameters. Since I would like early function calls to propegate down through the function calls to the end-call, and return back results all the way up.

tl;dr: There's nothing saying (any longer) that sys_call has to utilize the **kwargs method of getting those, so go for it. If you want to clean that beast up, I'd welcome the change : )

from archinstall.

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.