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

Export detect function #4

Closed
albinekb opened this issue Aug 14, 2018 · 1 comment · Fixed by #8
Closed

Export detect function #4

albinekb opened this issue Aug 14, 2018 · 1 comment · Fixed by #8

Comments

@albinekb
Copy link

We're using this module in hyper: https://github.com/zeit/hyper/blob/canary/app/session.js#L4

Since we require this module at startup, we won't see changes to the default shell, requiring a restart to use the new default shell after changing it.

I have some ideas on how to fix this, but the best might be to export the detect function too,

const detect = () => {
	const env = process.env;

	if (process.platform === 'darwin') {
		return env.SHELL || '/bin/bash';
	}

	if (process.platform === 'win32') {
		return env.COMSPEC || 'cmd.exe';
	}

	return env.SHELL || '/bin/sh';
})
module.exports = detect();
module.exports.detect = detect

another way would be to purge the require cache in hyper, but that feels hacky.

another way is to just copy this module code into hyper/lib.

Thoughts?

@sindresorhus
Copy link
Owner

Sure, a detect method makes sense. PR welcome.

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 a pull request may close this issue.

2 participants