Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 14, 2026

On Windows, vfox upgrade re-launches with admin privileges but only passed "upgrade" to the elevated process, discarding flags like --debug. Additionally, ShellExecuteW failures were silent.

Changes

Argument forwarding: Pass all os.Args[1:] to elevated process instead of just command name

Windows command-line escaping: Implement proper argument escaping per Microsoft rules:

  • Quote arguments containing spaces, tabs, newlines, or quotes
  • Double backslashes before quotes and at string end when quoted
  • Leave simple arguments unquoted

Error handling: Check ShellExecuteW return value (must be > 32)

Implementation

// Before: only command name passed
arg, _ := syscall.UTF16PtrFromString(SelfUpgradeName)

// After: all arguments with proper escaping
quotedArgs := make([]string, 0, len(os.Args)-1)
for _, arg := range os.Args[1:] {
    quotedArgs = append(quotedArgs, escapeArg(arg))
}
args := strings.Join(quotedArgs, " ")
arg, _ := syscall.UTF16PtrFromString(args)

// Check for failure
ret, _, _ := run.Call(...)
if ret <= 32 {
    return syscall.Errno(ret)
}

The escapeArg() function handles edge cases like path with space\\"path with space\\\\" and --flag="value""--flag=\"value\"".

Original prompt

This section details on the original issue you should resolve

<issue_title>[BUG]: vfox upgrade not work</issue_title>
<issue_description>Version
v0.9.2
OS
Windows

Describe the bug
vfox upgrade didn't work; it only outputs the current version and the latest available. Otherwise, I added the --debug for showing debug information, but it didn't work either.

Screenshots[optional]

Image</issue_description>

<agent_instructions>Please check for any issues.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 5 commits January 14, 2026 11:30
…or errors

Co-authored-by: aooohan <40265686+aooohan@users.noreply.github.com>
Co-authored-by: aooohan <40265686+aooohan@users.noreply.github.com>
Co-authored-by: aooohan <40265686+aooohan@users.noreply.github.com>
Co-authored-by: aooohan <40265686+aooohan@users.noreply.github.com>
Co-authored-by: aooohan <40265686+aooohan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix vfox upgrade command functionality Fix Windows upgrade command to preserve command-line arguments during elevation Jan 14, 2026
Copilot AI requested a review from aooohan January 14, 2026 11:40
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.

[BUG]: vfox upgrade not work

2 participants