This directory contains minimal reproduction cases for dax issue #300: "Execution error that may be due to missing tty or streams for Multiple layers of Dax+Jupyter Notebooks"
When dax is used to execute a process (like Jupyter) that runs code containing dax commands, the nested dax execution fails with:
Error: Exited with code: 128
at CommandChild.pipedStdoutBuffer
Dax defaults to using "inherit" for stdout/stderr streams. In nested execution contexts (especially non-interactive environments like Jupyter notebooks), stdio inheritance fails because the parent process's streams aren't properly available or configured.
Key locations in dax source:
- Default stdio config:
src/command.ts:138-143 - Error thrown:
src/command.ts:783 - Stdio mapping:
src/commands/executable.ts:126-134
The simplest way to test nested dax execution:
deno run --allow-all minimal_repro.tsThis script:
- Creates an inner script that uses dax
- Attempts to run it using outer dax with different stdio configurations
- Tests failure scenarios with default stdio inheritance
- Shows it works with explicit piped stdio
Note: This minimal reproduction actually succeeds in all scenarios when run in a normal terminal environment. The issue appears to be specific to Jupyter's non-interactive environment where stdio streams are handled differently.
Full reproduction matching the original issue report:
Setup:
# Install Jupyter
pip install jupyter
# Install Deno Jupyter kernel
deno jupyter --installRun:
# Execute the test harness
deno run --allow-all run_notebook.tsThis demonstrates the full nested scenario:
- Outer dax (in run_notebook.ts)
- Executes Jupyter nbconvert
- Which runs notebook_with_dax.ipynb
- Which contains dax commands (inner dax)
A basic script using dax that works fine on its own:
deno run --allow-all simple_dax_command.tsThis succeeds because there's no nested execution.
All scenarios should execute successfully, with dax commands working in any context.
- ✓ Simple dax command works
- ✗ Nested dax execution fails with exit code 128
- ✓ Using explicit
.stdout("piped").stderr("piped")works - ✓ Using native
Deno.Commandinstead of dax works
Until this is fixed, you can work around the issue by explicitly piping stdio:
// Instead of:
await $`command`;
// Use:
await $`command`.stdout("piped").stderr("piped");The issue can be fixed by detecting non-interactive/Jupyter environments and automatically using piped stdio instead of inherited stdio. See analysis in the issue comments for detailed implementation options.
minimal_repro.ts- Simplest reproduction without Jupyterrun_notebook.ts- Full Jupyter notebook execution scenarionotebook_with_dax.ipynb- Jupyter notebook using daxsimple_dax_command.ts- Basic dax script (works fine)README.md- This file
Once a fix is implemented, run all reproduction scripts to verify:
- Nested dax execution works in all scenarios
- Default behavior unchanged for normal (non-nested) execution
- Jupyter notebook execution succeeds
- No regressions in existing functionality