Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go home doesn't actually work #177

Closed
fuzzygroup opened this issue Aug 22, 2016 · 3 comments
Closed

Go home doesn't actually work #177

fuzzygroup opened this issue Aug 22, 2016 · 3 comments

Comments

@fuzzygroup
Copy link
Contributor

In the fun module it appears as if go home should work but it actually doesn't because the command isn't executed.

@matthewsedam
Copy link

It appears that the command is executed, but it is executed in the betty process. So, if you execute "betty go home" in bash, for example, betty runs the command and changes the directory but the directory in the parent bash process is not changed as "cd ~" is not ran through bash. I do not believe there is a way around this as bash would have to listen for a signal from betty.

@jonmarkprice
Copy link
Contributor

I think the only way around this would be for betty to replace the parent process (i.e. the shell) with a new process. After executing cd ~, we'd have to call exec bash. However, not everyone uses bash, so we'd need to detect which shell they were using when they launched betty.

Something like this:

#!/usr/bin/ruby
parent = Process.ppid
shell = %x{ps -q #{parent} -o comm=}
exec("cd ~; exec #{shell}")

will open a new instance of the correct shell at the user's home directory, but it will still be running atop the old shell. Thus if you type 'exit', you will appear back in the old instance of bash, etc. Also if you click to close the console window it will warn you about running child processes.
The only way that I can think of to get around this would be to open a new terminal window (e.g. x-terminal-emulator on Linux) but this will cause the new window animation to show up and will clear the screen and lose recent command history.
Thus I don't think there is a good solution to this problem without making betty a shell in its own right. So I think the "go home" functionality should be removed.

@matthewsedam
Copy link

I agree.

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

No branches or pull requests

4 participants