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

Explore bun shell #1062

Open
adamziel opened this issue Feb 27, 2024 · 1 comment
Open

Explore bun shell #1062

adamziel opened this issue Feb 27, 2024 · 1 comment

Comments

@adamziel
Copy link
Collaborator

The Bun Shell is a new experimental embedded language and interpreter in Bun that allows you to run cross-platform shell scripts in JavaScript & TypeScript.

https://bun.sh/blog/the-bun-shell

This could be useful for:

  • Parsing and handling proc_open() commands in the browser – right now we use a custom and naive command parser that doesn't understand env variables, pipes, or redirects
  • Windows-compatible repository setup – right now there's a lot of cp, rm, etc calls in package.json and project.json files

cc @reimic

adamziel added a commit that referenced this issue Feb 27, 2024
Introduces a naive shell command parser to provide equally good support
for the following two types of `proc_open()` calls:

```php
proc_open([ "wp-cli.phar", "plugin", "install", "gutenberg" ]);
proc_open("wp-cli.phar plugin install gutenberg" ]);
```

The command parsing semantics are extremely naive at this point and only
cover splitting the command into an array of arguments as follows:

```ts
splitShellCommand(`wp option set      blogname "My \"fancy\" blog "'name'`);
> ["wp", "option", "set", "blogname", `my "fancy" blog name`]
```

There is no support for inline ENV variables, pipes, or redirects. For
those, we might need to build an actual shell binary OR turn to
something like [bun
shell](#1062).

## Testing instructions

This PR ships unit tests so just confirm the CI checks pass.

## Related resources

* #1031
* #1062
* #1051
@reimic
Copy link
Contributor

reimic commented Mar 2, 2024

I've heard good things about bun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants