Skip to content

Commit d9f8a75

Browse files
authored
docs: fix example for within function (google#625)
- because `nvm use 16` must be part of prefix to allow using Node.js 16 inside the context
1 parent d1cd1aa commit d9f8a75

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,15 @@ await $`pwd` // => /home/path
233233
```
234234

235235
```js
236+
await $`node --version` // => v20.2.0
237+
236238
let version = await within(async () => {
237-
$.prefix += 'export NVM_DIR=$HOME/.nvm; source $NVM_DIR/nvm.sh; '
238-
await $`nvm use 16`
239-
return $`node -v`
239+
$.prefix += 'export NVM_DIR=$HOME/.nvm; source $NVM_DIR/nvm.sh; nvm use 16;'
240+
241+
return $`node --version`
240242
})
243+
244+
echo(version) // => v16.20.0
241245
```
242246

243247
### `retry()`

0 commit comments

Comments
 (0)