Motivation
While testing lessons/win_scripts/batch/run (a wrapper for running .cmd
lessons from git-bash/MSYS2/Cygwin), we noticed MSYS2 can hand .cmd/.bat
files straight to Windows' own CreateProcess, which auto-invokes cmd.exe
for you. That raised the question: could Wine provide the same kind of
bridge on real Linux/macOS, letting batch, wsh.vbscript, and
wsh.jscript run in CI (currently ubuntu-latest-only) and locally on
non-Windows machines, rather than being Windows-only?
Wine ships its own cmd.exe, cscript/wscript, and JScript/VBScript
engine implementations (jscript.dll/vbscript.dll) - built out because so
many real Windows installers depend on them - so this seems plausible
without heroics.
Proposed approach
-
Manual smoke test first (before any harness work): run each lesson
category under Wine by hand:
wine cmd /c a00.output.cmd
wine cscript //Nologo a00.output.vbs
wine cscript //Nologo a00.output.js
Confirm how much of the existing lesson set actually passes as-is.
Batch is the safer bet; WSH is the bigger unknown since scripts commonly
reach into the broader COM object model (WScript.Shell,
FileSystemObject, WScript.Arguments/StdIn), and Wine's coverage of
those peripheral objects is patchier than the language engines
themselves.
-
Harness changes (testbox/Script.rb) - native_unix? currently
gates :cmd/:js/:vbs out entirely on real Linux/macOS (they're only
ever expected to run under CommandShellScript/native Windows). Needs a
real branch resolving to wine cmd/wine cscript instead of failing
the "cannot find X on PATH" check, plus @@option/invocation_name
adjustments since Wine changes the actual command line shape.
-
CI wiring (.github/workflows/ci.yml) - add batch, wsh.vbscript,
wsh.jscript matrix entries on ubuntu-latest, with an "install Wine if
missing" step matching the existing pwsh/dash/bc pattern already
used for powershell/posix/bash.
Open questions / risks
- How complete is Wine's
cmd.exe batch interpreter vs. real Windows for
the constructs these lessons actually use (for, delayed expansion,
goto)?
- Does Wine's WSH/COM coverage extend far enough for the
d0/n0-style
lessons that read input or enumerate environment variables?
- First-run Wine prefix initialization (Gecko/Mono prompts) needs to be
handled non-interactively for CI.
- Performance overhead per invocation, multiplied across ~48 lessons per
language, in a CI job.
Out of scope for now
No harness/CI changes until the manual smoke test in step 1 confirms this
is worth building.
Motivation
While testing
lessons/win_scripts/batch/run(a wrapper for running.cmdlessons from git-bash/MSYS2/Cygwin), we noticed MSYS2 can hand
.cmd/.batfiles straight to Windows' own
CreateProcess, which auto-invokescmd.exefor you. That raised the question: could Wine provide the same kind of
bridge on real Linux/macOS, letting
batch,wsh.vbscript, andwsh.jscriptrun in CI (currently ubuntu-latest-only) and locally onnon-Windows machines, rather than being Windows-only?
Wine ships its own
cmd.exe,cscript/wscript, and JScript/VBScriptengine implementations (
jscript.dll/vbscript.dll) - built out because somany real Windows installers depend on them - so this seems plausible
without heroics.
Proposed approach
Manual smoke test first (before any harness work): run each lesson
category under Wine by hand:
Confirm how much of the existing lesson set actually passes as-is.
Batch is the safer bet; WSH is the bigger unknown since scripts commonly
reach into the broader COM object model (
WScript.Shell,FileSystemObject,WScript.Arguments/StdIn), and Wine's coverage ofthose peripheral objects is patchier than the language engines
themselves.
Harness changes (
testbox/Script.rb) -native_unix?currentlygates
:cmd/:js/:vbsout entirely on real Linux/macOS (they're onlyever expected to run under
CommandShellScript/native Windows). Needs areal branch resolving to
wine cmd/wine cscriptinstead of failingthe "cannot find X on PATH" check, plus
@@option/invocation_nameadjustments since Wine changes the actual command line shape.
CI wiring (
.github/workflows/ci.yml) - addbatch,wsh.vbscript,wsh.jscriptmatrix entries onubuntu-latest, with an "install Wine ifmissing" step matching the existing
pwsh/dash/bcpattern alreadyused for
powershell/posix/bash.Open questions / risks
cmd.exebatch interpreter vs. real Windows forthe constructs these lessons actually use (
for, delayed expansion,goto)?d0/n0-stylelessons that read input or enumerate environment variables?
handled non-interactively for CI.
language, in a CI job.
Out of scope for now
No harness/CI changes until the manual smoke test in step 1 confirms this
is worth building.