Macchina-CLI / libmacchina

A library providing access to all sorts of system information.
https://crates.io/crates/libmacchina
MIT License
68 stars 20 forks source link

macOS: failing to retreive `shell` #101

Closed luckman212 closed 2 years ago

luckman212 commented 2 years ago

(Sorry in advance if this is the wrong place to report this)

I installed macchina using Homebrew on macOS 12.1.

When I run it using this config, it fails to retreive the shell info:

interface = "en0"
long_uptime = true
long_shell = true
long_kernel = false
current_shell = true
physical_cores = true 
show = [
    "Host",
    "Machine",
    "Uptime",
    "OperatingSystem",
    "LocalIP",
    "Shell",
    "Packages",
    "Resolution",
    "Terminal",
    "Processor",
    "ProcessorLoad",
    "Memory"
]

However, if I run it with macchina -c /dev/null it does print it. Screenshot below. Not sure where the issue is but I guess maybe because the mod.rs module tries to look at /proc which doesn't exist on macOS? But not sure why it works with a null config... (I use bash btw)

CleanShot 2021-12-15 at 09 11 43@2x

grtcdr commented 2 years ago

Hi!

(Sorry in advance if this is the wrong place to report this)

Nope, you reported the issue to the right repo, thank you for this :)

Can you please post --doctor's output so I can see what's going wrong with the Shell readout?

No need, you're absolutely right:

Not sure where the issue is but I guess maybe because the mod.rs module tries to look at /proc which doesn't exist on macOS?

Right on! It seems like I haven't paid attention to this very detail.

But not sure why it works with a null config...

The default configuration displays your user's default shell as defined by the passwd struct.

You just debugged the whole thing! I'll fix this right up :construction_worker_man:

grtcdr commented 2 years ago

macchina will automatically pick up on this error (and report it) in the next release, so our work is finished :)

luckman212 commented 2 years ago

@grtcdr Amazing, thank you!

grtcdr commented 2 years ago

My pleasure :smile: