BlyxDocumentation
Browse chapters
Documentation / Workflow recipes

Pipit · Resume a batch after a failed command

Plan the next CLI batch from child exit codes and a failure allowance.

Resume a batch after a failed command

A batch script can erase an earlier error when the last child exits successfully. Use the whole exit trace to decide whether work should continue. One of three commands failed with exit code 3. The configured allowance permits two further commands.

Run the framework with your own input

Install Blyx 0.2.1 and a Rust toolchain with a host linker, then run the versioned project. Each positional argument is a number or a comma-separated numerical vector. The CLI accepts up to 16 entries per vector. The imported module accepts longer inputs.

git clone --depth 1 --branch v0.1.0 https://github.com/Rahulchaube1/blyx-pipit.git
cd blyx-pipit
blyxc native-run project.blyx -- "0,3,0" 8 2 1

API and return values

Returns [next offset, next count, failures, first nonzero exit]. The next count becomes zero once failures exceed the allowance. Invalid input returns an empty vector.

ArgumentAccepted input
codesVector of: whole byte in [0,255]
totalnonnegative exact integer
batchpositive exact integer
tolerancenonnegative exact integer

Use the libraries independently

The framework vendors the same library source published in these two repositories. Each module has its own package page, input contract and regression suite.

Try the program

Output Ready
Expected output
3
2
1
3
Open in the full playground →

Practice

Change codes = [0, 3], tolerance = 0.0. Predict the result, then run the program.

Hint

Returns [next offset, next count, failures, first nonzero exit]. The next count becomes zero once failures exceed the allowance.

Worked solution

The result vector is [2, 0, 1, 3]. Compare its fields with the return layout in the API section.

Find

    let codes = [0, 3, 0];

Replace with

    let codes = [0, 3];

Find

    let tolerance = 1.0;

Replace with

    let tolerance = 0.0;

Output after the change

2
0
1
3