Skip to content

Commit

Permalink
Add repro for rollup/rollup#4995.
Browse files Browse the repository at this point in the history
  • Loading branch information
mlstich committed May 16, 2023
1 parent b937a65 commit 25d4416
Show file tree
Hide file tree
Showing 7 changed files with 148 additions and 0 deletions.
59 changes: 59 additions & 0 deletions README.md
@@ -0,0 +1,59 @@
### Goal

Demonstrate / reproduce the issue reported in https://github.com/rollup/rollup/issues/4995.

### Prerequisites

`node` and `npx` need to be installed.

First do an `npm install`.

### How-To

The issue can be reproduced both exec both of `@actions/exec` and `child_process`. The node scripts each use the respective `exec` function to invoke [test.sh](test.sh). The bash script uses `npx` to invoke _rollup_, first v3.21.5 (OK), then v3.21.6 (NOK). After that second invocation, the subsequent `echo` fails.

@actions/exec:

```
node actions.js
```

child_process:

```
node child_process.js
```

### Errors

@actions/exec:

```
Error occurred during test.sh: Error: The process '/bin/bash' failed with exit code null
at ExecState._setResult (/Users/manu/incon.ai/rollup-stdout-repro/node_modules/@actions/exec/lib/toolrunner.js:592:25)
at ExecState.CheckComplete (/Users/manu/incon.ai/rollup-stdout-repro/node_modules/@actions/exec/lib/toolrunner.js:575:18)
at ChildProcess.<anonymous> (/Users/manu/incon.ai/rollup-stdout-repro/node_modules/@actions/exec/lib/toolrunner.js:469:27)
at ChildProcess.emit (node:events:513:28)
at maybeClose (node:internal/child_process:1091:16)
at Socket.<anonymous> (node:internal/child_process:449:11)
at Socket.emit (node:events:513:28)
at Pipe.<anonymous> (node:net:322:12)
```

child_process:

```
Error occurred during test.sh: Error: Command failed: bash test.sh
[...]
at ChildProcess.exithandler (node:child_process:419:12)
at ChildProcess.emit (node:events:513:28)
at maybeClose (node:internal/child_process:1091:16)
at Socket.<anonymous> (node:internal/child_process:449:11)
at Socket.emit (node:events:513:28)
at Pipe.<anonymous> (node:net:322:12) {
code: null,
killed: false,
signal: 'SIGPIPE',
cmd: 'bash test.sh'
}
```
12 changes: 12 additions & 0 deletions actions.js
@@ -0,0 +1,12 @@
const { exec } = require('@actions/exec');

async function test() {
try {
await exec('bash test.sh');
console.log('test.sh completed successfully!');
} catch (error) {
console.error('Error occurred during test.sh:', error);
}
}

test();
19 changes: 19 additions & 0 deletions child_process.js
@@ -0,0 +1,19 @@
const { exec } = require('child_process');

function test() {
exec('bash test.sh', (error, stdout, stderr) => {
if (error) {
console.error('Error occurred during test.sh:', error);
} else {
console.log('test.sh completed successfully!');
}
if (stdout) {
console.log('test.sh output:', stdout);
}
if (stderr) {
console.error('test.sh error output:', stderr);
}
});
}

test();
28 changes: 28 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions package.json
@@ -0,0 +1,14 @@
{
"name": "nodetest",
"version": "1.0.0",
"description": "",
"main": "actions.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"dependencies": {
"@actions/exec": "^1.1.1"
}
}
7 changes: 7 additions & 0 deletions rollup.config.js
@@ -0,0 +1,7 @@
module.exports = {
input: 'actions.js',
output: {
file: 'dist/bundle.js',
format: 'es',
},
};
9 changes: 9 additions & 0 deletions test.sh
@@ -0,0 +1,9 @@
echo "before"

npx rollup@3.21.5 -c

echo "between"

npx rollup@3.21.6 -c

echo "after"

0 comments on commit 25d4416

Please sign in to comment.