mirror of
https://github.com/nick-fields/retry.git
synced 2026-02-09 22:58:02 +00:00
Merge pull request #22 from nick-invision/nrf/add-logging-test
Fix command output
This commit is contained in:
3
.github/scripts/log-examples.js
vendored
Normal file
3
.github/scripts/log-examples.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
console.log('console.log test');
|
||||
process.stdout.write('stdout test\n');
|
||||
process.stderr.write('stderr test\n');
|
||||
6
.github/workflows/ci_cd.yml
vendored
6
.github/workflows/ci_cd.yml
vendored
@@ -31,6 +31,12 @@ jobs:
|
||||
expected: true
|
||||
actual: ${{ steps.happy_path.outputs.total_attempts == '1' && steps.happy_path.outputs.exit_code == '0' }}
|
||||
|
||||
- name: log examples
|
||||
uses: ./
|
||||
with:
|
||||
command: node ./.github/scripts/log-examples.js
|
||||
timeout_minutes: 1
|
||||
|
||||
- name: sad-path (retry_wait_seconds)
|
||||
id: sad_path_wait_sec
|
||||
uses: ./
|
||||
|
||||
12
dist/exec.js
vendored
12
dist/exec.js
vendored
@@ -1,12 +0,0 @@
|
||||
const { exec } = require('child_process');
|
||||
const COMMAND = process.argv.splice(2)[0];
|
||||
|
||||
function run() {
|
||||
exec(COMMAND, { stdio: 'inherit' }, (err) => {
|
||||
if (err) {
|
||||
process.exit(err.code);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
run();
|
||||
14
dist/index.js
vendored
14
dist/index.js
vendored
@@ -415,7 +415,7 @@ module.exports = require("path");
|
||||
/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) {
|
||||
|
||||
const { getInput, error, warning, info, debug, setOutput } = __webpack_require__(470);
|
||||
const { spawn } = __webpack_require__(129);
|
||||
const child_process = __webpack_require__(129);
|
||||
const { join } = __webpack_require__(622);
|
||||
const ms = __webpack_require__(156);
|
||||
var kill = __webpack_require__(791);
|
||||
@@ -489,7 +489,17 @@ async function runCmd() {
|
||||
exit = 0;
|
||||
done = false;
|
||||
|
||||
var child = spawn('node', [__webpack_require__.ab + "exec.js", COMMAND], { stdio: 'inherit' });
|
||||
const file = COMMAND.split(' ')[0];
|
||||
const args = COMMAND.split(' ').slice(1);
|
||||
|
||||
var child = child_process.exec(COMMAND, { stdio: 'inherit' });
|
||||
|
||||
child.stdout.on('data', (data) => {
|
||||
console.log(data);
|
||||
});
|
||||
child.stderr.on('data', (data) => {
|
||||
console.log(data);
|
||||
});
|
||||
|
||||
child.on('exit', (code, signal) => {
|
||||
debug(`Code: ${code}`);
|
||||
|
||||
12
src/exec.js
12
src/exec.js
@@ -1,12 +0,0 @@
|
||||
const { exec } = require('child_process');
|
||||
const COMMAND = process.argv.splice(2)[0];
|
||||
|
||||
function run() {
|
||||
exec(COMMAND, { stdio: 'inherit' }, (err) => {
|
||||
if (err) {
|
||||
process.exit(err.code);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
run();
|
||||
14
src/index.js
14
src/index.js
@@ -1,5 +1,5 @@
|
||||
const { getInput, error, warning, info, debug, setOutput } = require('@actions/core');
|
||||
const { spawn } = require('child_process');
|
||||
const child_process = require('child_process');
|
||||
const { join } = require('path');
|
||||
const ms = require('milliseconds');
|
||||
var kill = require('tree-kill');
|
||||
@@ -73,7 +73,17 @@ async function runCmd() {
|
||||
exit = 0;
|
||||
done = false;
|
||||
|
||||
var child = spawn('node', [join(__dirname, 'exec.js'), COMMAND], { stdio: 'inherit' });
|
||||
const file = COMMAND.split(' ')[0];
|
||||
const args = COMMAND.split(' ').slice(1);
|
||||
|
||||
var child = child_process.exec(COMMAND, { stdio: 'inherit' });
|
||||
|
||||
child.stdout.on('data', (data) => {
|
||||
console.log(data);
|
||||
});
|
||||
child.stderr.on('data', (data) => {
|
||||
console.log(data);
|
||||
});
|
||||
|
||||
child.on('exit', (code, signal) => {
|
||||
debug(`Code: ${code}`);
|
||||
|
||||
Reference in New Issue
Block a user