Giter VIP home page Giter VIP logo

Comments (12)

grtcdr avatar grtcdr commented on June 24, 2024 1

Absolutely, go ahead!

I await the improvements your pull request will bring :)

from macchina.

grtcdr avatar grtcdr commented on June 24, 2024 1

You'll have to manually traverse /proc and compare the values of /proc/<TERMPID>/comm and /proc/<TERMPID>/cmdline.

cmdline should hopefully show you an output like the one returned by the ps command you mentioned.

If it does, and you think the output of cmdline is more consistent, I'd be happy to include the change.

from macchina.

grtcdr avatar grtcdr commented on June 24, 2024 1

Thank you, I'll review it as soon as possible :)

from macchina.

grtcdr avatar grtcdr commented on June 24, 2024

The current implementation parses /proc to determine the most likely
terminal, but it does so through the /proc/PID/comm file which we
have no way of saniziting.

$TERM has proven to be unreliable at detecting the real terminal
being used (anyone can for example set the variable to xterm and
that would then be reflected in macchina).

$TERMINFO is new to me, I've never had to directly interact with it.

I believe we're better off returning the relevant terminfo description
directly.

from macchina.

yavko avatar yavko commented on June 24, 2024

The current implementation parses /proc to determine the most likely terminal, but it does so through the /proc/PID/comm file which we have no way of saniziting.

Ah makes sense

$TERM has proven to be unreliable at detecting the real terminal being used (anyone can for example set the variable to xterm and that would then be reflected in macchina).

Thats true, I have seen that done a lot

$TERMINFO is new to me, I've never had to directly interact with it.

I believe we're better off returning the relevant terminfo description directly.

Yeah, I agree, idk if this helps but I found a crate that could aid in this https://crates.io/crates/terminfo

from macchina.

grtcdr avatar grtcdr commented on June 24, 2024

Yeah, I agree, idk if this helps but I found a crate that could aid in this https://crates.io/crates/terminfo

Yeah it looks like it will, I was never really a fan of our little procfs hack.

from macchina.

yavko avatar yavko commented on June 24, 2024

Yeah, I agree, idk if this helps but I found a crate that could aid in this crates.io/crates/terminfo

Yeah it looks like it will, I was never really a fan of our little procfs hack.

Oh yeah definitely seems pretty hacky

from macchina.

yavko avatar yavko commented on June 24, 2024

@grtcdr If you'd like I can write up something with this, just wanna know in case someone has already started on this.

from macchina.

yavko avatar yavko commented on June 24, 2024

Absolutely, go ahead!

I await the improvements your pull request will bring :)

After implementing terminfo, it seem futile, same issue as with $TERM

with terminfo name:
image

with description:
image

from macchina.

yavko avatar yavko commented on June 24, 2024

I found this result on stackoverflow that uses ps -o 'cmd=' -p $(ps -o 'ppid=' -p $$) to get the term name, which results in something like this
image
could the path then be stripped to only get exec name, as this method seems to use the exact exec name

from macchina.

yavko avatar yavko commented on June 24, 2024

Okay, so it sorta works. I mean it does, but when its in a nix-shell it says rc, which happens to be the exec name of nix shells. I'm quite sad, because I kept getting rc, and was very confused until i just ran ps, and it also said rc
image
image

I'll make the pr now

from macchina.

yavko avatar yavko commented on June 24, 2024

I've made a PR now! Macchina-CLI/libmacchina#130

from macchina.

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.