Open fromkeith opened 2 hours ago
When a task fails, Foy stops, and exits with an exit code of "0". I would expect it to exit with a non-zero exit code. This makes it impossible to abort an automated build.
Foyfile.js
const { task, desc, option, fs, logger } = require('foy'); task('test', async (ctx) => { const result = await ctx.exec('exit 1'); console.log(`result: ${result.exitCode}`); });
Command + Output:
> foy-test$ npx foy test [info] $ exit 1 [error] Error: Command failed with ENOENT: exit 1 spawn exit ENOENT at ChildProcess._handle.onexit (node:internal/child_process:286:19) at onErrorNT (node:internal/child_process:484:16) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { errno: -2, code: 'ENOENT', syscall: 'spawn exit', path: 'exit', spawnargs: [ '1' ], originalMessage: 'spawn exit ENOENT', shortMessage: 'Command failed with ENOENT: exit 1\nspawn exit ENOENT', command: 'exit 1', exitCode: undefined, signal: undefined, signalDescription: undefined, stdout: undefined, stderr: undefined, failed: true, timedOut: false, isCanceled: false, killed: false } ✖ test [duration: 0.08s] > foy-test$ echo $? 0
I would have expected echo $? to print 1, indicating the task failed. And thus stopping execution.
echo $?
1
Another example quickly... I would expect npx foy test && echo "Hello" to not print Hello, but since foy returns 0, it is printed.
npx foy test && echo "Hello"
Hello
foy
When a task fails, Foy stops, and exits with an exit code of "0". I would expect it to exit with a non-zero exit code. This makes it impossible to abort an automated build.
Test Case
Foyfile.js
Command + Output:
I would have expected
echo $?
to print1
, indicating the task failed. And thus stopping execution.