fix(windows): pass explicit working directory to ttyd to prevent Error 267 - #773
Open
gitKashish wants to merge 1 commit into
Open
fix(windows): pass explicit working directory to ttyd to prevent Error 267#773gitKashish wants to merge 1 commit into
gitKashish wants to merge 1 commit into
Conversation
…valid path bug on windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #754.
This PR fixes a bug where
vhspanics and crashes during setup on Windows when using the latest officialttydrelease (v1.7.7). I encountered this exact issue when runningpowershelltapes.The Bug
When running a tape file on Windows,
vhspanics because thettydserver instantly crashes in the background, causinggo-rodto lose its WebSocket connection:The Investigation
Running the
vhsbackground command (ttyd -p 7654 powershell) manually reveals thatttydis crashing natively with:== CreateProcessW failed with error 267: The directory name is invalid.This is a known issue in
ttyd(see tsl0922/ttyd#1292). In the Windows source code (pty_spawn), if a working directory isn't explicitly provided, the default directory resolution fails and passes a malformed string toCreateProcessW(see the exact lines throwing the error.Upstream Context & Fix
This directory resolution bug seems to have been addressed upstream in
ttydPR tsl0922/ttyd#1502. However,ttydhas not cut a new release in over 2 years, meaning allvhsWindows users downloading the latest official binaries are still subjected to this crash.By explicitly appending
-w .to thettydarguments insidetty.gofor Windows, we forcettydto use the current native directory. This bypasses the upstream bug entirely and allowsvhsto successfully spawn the process and record the tape.Steps to Reproduce (Before)
ttyd(1.7.7) on Windows.vhs demo.tape.vhspanics withuse of closed network connection.Steps to Reproduce (After)
vhs demo.tapeon Windows.ttydsuccessfully launches the shell using the explicit-w .flag.