github.com/jfrog/frogbot@v1.1.1-0.20231221090046-821a26f50338/action/node_modules/@actions/exec/README.md (about) 1 # `@actions/exec` 2 3 ## Usage 4 5 #### Basic 6 7 You can use this package to execute tools in a cross platform way: 8 9 ```js 10 const exec = require('@actions/exec'); 11 12 await exec.exec('node index.js'); 13 ``` 14 15 #### Args 16 17 You can also pass in arg arrays: 18 19 ```js 20 const exec = require('@actions/exec'); 21 22 await exec.exec('node', ['index.js', 'foo=bar']); 23 ``` 24 25 #### Output/options 26 27 Capture output or specify [other options](https://github.com/actions/toolkit/blob/d9347d4ab99fd507c0b9104b2cf79fb44fcc827d/packages/exec/src/interfaces.ts#L5): 28 29 ```js 30 const exec = require('@actions/exec'); 31 32 let myOutput = ''; 33 let myError = ''; 34 35 const options = {}; 36 options.listeners = { 37 stdout: (data: Buffer) => { 38 myOutput += data.toString(); 39 }, 40 stderr: (data: Buffer) => { 41 myError += data.toString(); 42 } 43 }; 44 options.cwd = './lib'; 45 46 await exec.exec('node', ['index.js', 'foo=bar'], options); 47 ``` 48 49 #### Exec tools not in the PATH 50 51 You can specify the full path for tools not in the PATH: 52 53 ```js 54 const exec = require('@actions/exec'); 55 56 await exec.exec('"/path/to/my-tool"', ['arg1']); 57 ```