Skip to content

pkg and internal commands#360

Merged
OutOfBedlam merged 14 commits intomainfrom
wip-service-pkg
Apr 2, 2026
Merged

pkg and internal commands#360
OutOfBedlam merged 14 commits intomainfrom
wip-service-pkg

Conversation

@OutOfBedlam
Copy link
Copy Markdown
Contributor

This pull request adds support for advanced stderr redirection in the shell parser and execution engine, and introduces more flexible process execution options. The most important changes include support for 2>, 2>>, and 2>&1 redirection operators, a new ExecOptions struct for customizing process I/O, and direct implementations of internal shell commands. Comprehensive tests are added to ensure correctness.

Shell parser and redirection support:

  • Added support for 2>, 2>>, and 2>&1 stderr redirection operators in the shell parser, allowing commands to redirect or merge stderr as in typical Unix shells. [1] [2] [3] [4]
  • Updated and expanded tests in parser_test.go to cover new stderr redirection features and tokenization. [1] [2] [3]

Engine execution options:

  • Introduced ExecOptions struct to allow callers to specify custom Stdin, Stdout, and Stderr streams when executing commands, and added ExecWithOptions and ExecStringWithOptions methods to JSRuntime. [1] [2] [3] [4]
  • Updated platform-specific exec0 implementations to use the new options for process I/O redirection. [1] [2]
  • Added tests for ExecWithOptions and ExecStringWithOptions to verify custom I/O handling.

Internal shell command refactoring:

  • Refactored internal shell commands (cd, setenv, unsetenv, which) to be implemented directly in Go, improving error handling and output flexibility.

These changes provide more robust and flexible shell command parsing and execution, bringing the shell closer to typical Unix shell behavior.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2026

Codecov Report

❌ Patch coverage is 72.41379% with 128 lines in your changes missing coverage. Please review.
✅ Project coverage is 46.34%. Comparing base (53e0d0f) to head (61b51e6).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
jsh/lib/shell/pipeline.go 65.54% 63 Missing and 29 partials ⚠️
jsh/lib/shell/shell.go 67.56% 9 Missing and 3 partials ⚠️
jsh/lib/shell/internal/internal.go 90.29% 8 Missing and 2 partials ⚠️
shell/session/entry.go 0.00% 8 Missing ⚠️
jsh/lib/shell/parser.go 88.46% 2 Missing and 1 partial ⚠️
jsh/engine/engine.go 93.33% 1 Missing ⚠️
mods/server/server.go 0.00% 1 Missing ⚠️
shell/session/session.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #360      +/-   ##
==========================================
- Coverage   46.35%   46.34%   -0.01%     
==========================================
  Files         325      326       +1     
  Lines       57945    58356     +411     
==========================================
+ Hits        26859    27047     +188     
- Misses      28095    28308     +213     
- Partials     2991     3001      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@OutOfBedlam OutOfBedlam merged commit 80ef811 into main Apr 2, 2026
8 of 9 checks passed
@OutOfBedlam OutOfBedlam deleted the wip-service-pkg branch April 2, 2026 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant