mirror of
https://github.com/actions/setup-node.git
synced 2025-06-30 06:33:48 +00:00
.
This commit is contained in:
parent
beb1329f9f
commit
2b95e76931
7736 changed files with 1874747 additions and 51184 deletions
21
node_modules/@actions/exec/README.md
generated
vendored
21
node_modules/@actions/exec/README.md
generated
vendored
|
@ -4,9 +4,9 @@
|
|||
|
||||
#### Basic
|
||||
|
||||
You can use this package to execute your tools on the command line in a cross platform way:
|
||||
You can use this package to execute tools in a cross platform way:
|
||||
|
||||
```
|
||||
```js
|
||||
const exec = require('@actions/exec');
|
||||
|
||||
await exec.exec('node index.js');
|
||||
|
@ -16,7 +16,7 @@ await exec.exec('node index.js');
|
|||
|
||||
You can also pass in arg arrays:
|
||||
|
||||
```
|
||||
```js
|
||||
const exec = require('@actions/exec');
|
||||
|
||||
await exec.exec('node', ['index.js', 'foo=bar']);
|
||||
|
@ -26,11 +26,11 @@ await exec.exec('node', ['index.js', 'foo=bar']);
|
|||
|
||||
Capture output or specify [other options](https://github.com/actions/toolkit/blob/d9347d4ab99fd507c0b9104b2cf79fb44fcc827d/packages/exec/src/interfaces.ts#L5):
|
||||
|
||||
```
|
||||
```js
|
||||
const exec = require('@actions/exec');
|
||||
|
||||
const myOutput = '';
|
||||
const myError = '';
|
||||
let myOutput = '';
|
||||
let myError = '';
|
||||
|
||||
const options = {};
|
||||
options.listeners = {
|
||||
|
@ -48,13 +48,10 @@ await exec.exec('node', ['index.js', 'foo=bar'], options);
|
|||
|
||||
#### Exec tools not in the PATH
|
||||
|
||||
You can use it in conjunction with the `which` function from `@actions/io` to execute tools that are not in the PATH:
|
||||
You can specify the full path for tools not in the PATH:
|
||||
|
||||
```
|
||||
```js
|
||||
const exec = require('@actions/exec');
|
||||
const io = require('@actions/io');
|
||||
|
||||
const pythonPath: string = await io.which('python', true)
|
||||
|
||||
await exec.exec(`"${pythonPath}"`, ['main.py']);
|
||||
await exec.exec('"/path/to/my-tool"', ['arg1']);
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue