shell-command icon indicating copy to clipboard operation
shell-command copied to clipboard

Feature request: support ksh under OpenBSD

Open leonstafford opened this issue 6 years ago • 1 comments

Feature Request

Add support for default shell on OpenBSD (ksh).

Describe your use case and the problem you are facing

Trying to use wp shell cmd under OpenBSD results in errors and exits prematurely.

$ wp shell
/bin/ksh: fc: history functions not available
/bin/ksh: read: -e: unknown option
$ echo $?
0

$ wp cli info
OS:     OpenBSD 6.6 GENERIC.MP#584 amd64
Shell:  /bin/ksh
PHP binary:     /usr/local/bin/php-7.3
PHP version:    7.3.13
php.ini used:   /etc/php-7.3.ini
WP-CLI root dir:        phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:      phar://wp-cli.phar/vendor
WP_CLI phar path:       /var/www/htdocs
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.4.0
$ env | grep WP_CLI_CUSTOM_SHELL
WP_CLI_CUSTOM_SHELL=/bin/ksh

Describe the solution you'd like

Quick win:

Add some more detection at shell instantiation to detect shell and platform to enable running in ksh on OpenBSD.

Nice to have:

Test in a few different shell/OS environments and modify to run across more - else, fail gracefully when unsupported.

Happy to work on this

leonstafford avatar Jan 26 '20 12:01 leonstafford

Thanks for the report, @leonstafford !

It looks like you're actually passing WP_CLI_CUSTOM_SHELL=/bin/ksh correctly. The problem is that this series of commands are failing:

https://github.com/wp-cli/shell-command/blob/3417708f9fc400e6e351a826dfcafbd459ec201b/src/WP_CLI/Shell/REPL.php#L130-L137

Do you know what it would take to rewrite this for compatibility with /bin/ksh?

danielbachhuber avatar Nov 29 '22 11:11 danielbachhuber