Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@scop
Copy link
Contributor

@scop scop commented May 1, 2021

SHELL in environment is not necessarily the current shell; POSIX
specifies it as the user's preferred one.

Use parent process name primarily instead, if available.

https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html

Case in point, in my Ubuntu 20.04:

$ zsh -lc 'echo $SHELL'
/bin/bash

@scop scop force-pushed the improve-autodetect branch 2 times, most recently from 32b1be0 to 1717bc9 Compare May 2, 2021 16:20
SHELL in environment is not necessarily the current shell; POSIX
specifies it as the user's preferred one.

Use parent process name primarily instead, if available.

https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html
@scop scop force-pushed the improve-autodetect branch from 1717bc9 to d169fe2 Compare May 2, 2021 21:30
@justjanne justjanne self-requested a review July 14, 2021 17:17
@justjanne justjanne self-assigned this Jul 14, 2021
@scop
Copy link
Contributor Author

scop commented Oct 10, 2021

Just wondering if there's anything I could do to nudge this forward ;)

@justjanne justjanne merged commit 4cbdaf1 into justjanne:main Oct 11, 2021
Comment on lines +85 to +93
var shellExe string
proc, err := process.NewProcess(int32(os.Getppid()))
if err == nil {
shellExe, _ = proc.Exe()
}
if shellExe == "" {
shellExe = os.Getenv("SHELL")
}
cfg.Shell = detectShell(shellExe)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like these changes broke some of the BSD builds. Not sure how big of a deal that is, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a gopsutil bug, #345 should fix it.

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

Successfully merging this pull request may close these issues.

3 participants