added .cmd() as alias for .exec()
This commit is contained in:
parent
866d38caf9
commit
731383a915
|
@ -30,6 +30,7 @@
|
|||
- Added new JSVM bindings:
|
||||
- `new Cookie({ ... })` constructor for creating `*http.Cookie` equivalent value.
|
||||
- `new SubscriptionMessage({ ... })` constructor for creating a custom realtime subscription payload.
|
||||
- Soft-deprecated `$os.exec()` in favour of `$os.cmd()` to make it more clear that the call only prepares the command and doesn't execute it.
|
||||
|
||||
|
||||
## v0.18.10
|
||||
|
|
|
@ -549,7 +549,8 @@ func osBinds(vm *goja.Runtime) {
|
|||
vm.Set("$os", obj)
|
||||
|
||||
obj.Set("args", os.Args)
|
||||
obj.Set("exec", exec.Command)
|
||||
obj.Set("exec", exec.Command) // @deprecated
|
||||
obj.Set("cmd", exec.Command)
|
||||
obj.Set("exit", os.Exit)
|
||||
obj.Set("getenv", os.Getenv)
|
||||
obj.Set("dirFS", os.DirFS)
|
||||
|
|
|
@ -1435,5 +1435,5 @@ func TestOsBindsCount(t *testing.T) {
|
|||
vm := goja.New()
|
||||
osBinds(vm)
|
||||
|
||||
testBindsCount(vm, "$os", 16, t)
|
||||
testBindsCount(vm, "$os", 17, t)
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -641,7 +641,26 @@ declare namespace $filepath {
|
|||
* @group PocketBase
|
||||
*/
|
||||
declare namespace $os {
|
||||
/**
|
||||
* Legacy alias for $os.cmd().
|
||||
*/
|
||||
export let exec: exec.command
|
||||
|
||||
/**
|
||||
* Prepares an external OS command.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ` + "```" + `js
|
||||
* // prepare the command to execute
|
||||
* const cmd = $os.cmd('ls', '-sl')
|
||||
*
|
||||
* // execute the command and return its standard output as string
|
||||
* const output = String.fromCharCode(...cmd.output());
|
||||
* ` + "```" + `
|
||||
*/
|
||||
export let cmd: exec.command
|
||||
|
||||
export let args: os.args
|
||||
export let exit: os.exit
|
||||
export let getenv: os.getenv
|
||||
|
|
Loading…
Reference in New Issue