Skip to content

Route shell commands through PowerShell -EncodedCommand to fix paths with spaces - #712

Merged
aooohan merged 2 commits into
version-fox:mainfrom
linghengqian:windows
Oct 2, 2026
Merged

aooohan merged 2 commits into
version-fox:mainfrom
linghengqian:windows

Conversation

@linghengqian

Copy link
Copy Markdown
Member

@linghengqian linghengqian left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CC @Chance-fyi @aooohan @bytemain . Could you help approve the CI run?

@aooohan
aooohan requested review from aooohan and a balanced review from Copilot September 30, 2026 11:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The Windows Lua overrides break existing shell and file-handle contracts and contain incorrect pipe, EOF, and status handling.

Review effort: Balanced
Findings: 1 High severity · 2 Medium severity · 1 Low severity

Open (4)
What changed in this PR

Routes Windows shell execution through PowerShell encoded commands to support paths containing spaces.

Changes:

  • Adds shared encoded PowerShell execution helpers.
  • Updates junctions, upgrades, shims, and Lua command execution.
  • Adds Windows-focused regression tests.
File Description
internal/​shared/​util/​shell.go Adds cross-platform shell helpers.
internal/​shared/​util/​shell_test.go Tests command encoding and construction.
internal/​shared/​util/​file.go Creates Windows junctions through PowerShell.
internal/​shared/​util/​file_windows_test.go Tests junction paths containing spaces.
internal/​shared/​shim/​shim_windows.go Escapes paths in generated shims.
internal/​plugin/​luai/​vm.go Installs Windows Lua execution overrides.
internal/​plugin/​luai/​exec.go Implements overridden Lua process APIs.
internal/​plugin/​development_output.go Uses the shared shell helper in development mode.
cmd/​commands/​upgrade.go Launches the upgrade script through PowerShell.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/plugin/luai/vm.go Resolved
Comment thread internal/plugin/luai/exec.go Resolved
Comment thread internal/plugin/luai/exec.go Resolved
Comment thread internal/shared/util/shell_test.go Resolved
@aooohan

aooohan commented Sep 30, 2026

Copy link
Copy Markdown
Member

Could you help approve the CI run?

Where is CI... I remember there was one before.

@linghengqian linghengqian left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you help approve the CI run?

Where is CI... I remember there was one before.

  • I’ve opened #713; I will address the review comments on the current PR after that one is merged.

@codecov

codecov Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 31.00000% with 138 lines in your changes missing coverage. Please review.
✅ Project coverage is 35.00%. Comparing base (930f5be) to head (96f9c8f).

Files with missing lines Patch % Lines
internal/plugin/luai/exec.go 25.51% 102 Missing and 6 partials ⚠️
internal/shared/util/file.go 0.00% 15 Missing ⚠️
internal/shared/util/shell.go 65.71% 10 Missing and 2 partials ⚠️
internal/shared/util/shell_notwindows.go 0.00% 2 Missing ⚠️
cmd/commands/upgrade.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #712      +/-   ##
==========================================
- Coverage   35.09%   35.00%   -0.09%     
==========================================
  Files          92       95       +3     
  Lines        6514     6702     +188     
==========================================
+ Hits         2286     2346      +60     
- Misses       3922     4043     +121     
- Partials      306      313       +7     

☔ View full report in Codecov by Harness.
📢 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.

@linghengqian linghengqian left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@aooohan
aooohan merged commit 5a54885 into version-fox:main Oct 2, 2026
6 checks passed
@linghengqian
linghengqian deleted the windows branch October 2, 2026 02:03
linghengqian added a commit to version-fox/vfox-flutter that referenced this pull request Oct 9, 2026
vfox main carries the fix for Windows homes containing a space
(version-fox/vfox#712), so its combos now point VFOX_HOME at
C:\Users\John Doe\.vfox, the layout from version-fox/vfox-flutter#33.
Released builds still fail on such paths, so they keep the unspaced
slot home.

The plugin only double-quotes Windows paths when they contain
whitespace: vfox main passes the command line to cmd.exe verbatim, so
the quotes survive, while released builds still re-quote the line and
mangle embedded double quotes.
linghengqian added a commit to version-fox/vfox-flutter that referenced this pull request Oct 9, 2026
vfox main carries the fix for Windows homes containing a space
(version-fox/vfox#712), so its combos now point VFOX_HOME at
C:\Users\John Doe\.vfox, the layout from version-fox/vfox-flutter#33.
Released builds still fail on such paths, so they keep the unspaced
slot home.

The plugin only double-quotes Windows paths when they contain
whitespace: vfox main passes the command line to cmd.exe verbatim, so
the quotes survive, while released builds still re-quote the line and
mangle embedded double quotes.
linghengqian added a commit to version-fox/vfox-flutter that referenced this pull request Oct 9, 2026
vfox main carries the fix for Windows homes containing a space
(version-fox/vfox#712), so its combos now point VFOX_HOME at
C:\Users\John Doe\.vfox, the layout from version-fox/vfox-flutter#33.
Released builds still fail on such paths, so they keep the unspaced
slot home.

The plugin only double-quotes Windows paths when they contain
whitespace: vfox main passes the command line to cmd.exe verbatim, so
the quotes survive, while released builds still re-quote the line and
mangle embedded double quotes.

Also check the license headers of YAML, TOML, Dockerfiles and ignore
files: SkyWalking Eyes already knows their comment style, so they no
longer need to be excluded from paths-ignore. go.mod and .gitattributes
get hand-written headers because the fixer knows no comment style for
them, as does Dockerfile-runner (the fixer only matches the exact name
`Dockerfile`). The two Windows Dockerfiles keep `# escape=` on line 1,
so their headers sit right below it. go.sum stays ignored: the go tool
parses every non-empty line as a hash record.
linghengqian added a commit to version-fox/vfox-flutter that referenced this pull request Oct 10, 2026
vfox main carries the fix for Windows homes containing a space
(version-fox/vfox#712), so its combos now point VFOX_HOME at
C:\Users\John Doe\.vfox, the layout from version-fox/vfox-flutter#33.
Released builds still fail on such paths, so they keep the unspaced
slot home.

The plugin only double-quotes Windows paths when they contain
whitespace: vfox main passes the command line to cmd.exe verbatim, so
the quotes survive, while released builds still re-quote the line and
mangle embedded double quotes.

Also check the license headers of YAML, TOML, Dockerfiles and ignore
files: SkyWalking Eyes already knows their comment style, so they no
longer need to be excluded from paths-ignore. go.mod and .gitattributes
get hand-written headers because the fixer knows no comment style for
them, as does Dockerfile-runner (the fixer only matches the exact name
`Dockerfile`). The two Windows Dockerfiles keep `# escape=` on line 1,
so their headers sit right below it. go.sum stays ignored: the go tool
parses every non-empty line as a hash record.
aooohan pushed a commit that referenced this pull request Nov 9, 2026
The Windows io.popen override added in #712 returns a table with read,
write and close only. gopher-lua's file and process handles also expose
lines(), so plugin code that iterates command output with
`for line in handle:lines()` fails with "attempt to call a non-function
object" before reading anything. vfox-python's PostInstall hits this while
enumerating its installer packages, which breaks `vfox install python` on
Windows.

Add a lines() method that returns an iterator backed by the same buffered
reader as read("*l"): one line without its trailing CR/LF per call, nil at
EOF, and an error on the write-only mode. This restores the contract the
override was meant to preserve.

Fixes #749

Co-authored-by: jlc <jlc@localhost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants