Skip to content

allow nuscripts to be run again on windows with assoc/ftype#14318

Merged
fdncred merged 2 commits intonushell:mainfrom
fdncred:fix_windows_cmd_assoc_scripts
Nov 15, 2024
Merged

allow nuscripts to be run again on windows with assoc/ftype#14318
fdncred merged 2 commits intonushell:mainfrom
fdncred:fix_windows_cmd_assoc_scripts

Conversation

@fdncred
Copy link
Copy Markdown
Contributor

@fdncred fdncred commented Nov 12, 2024

Description

This PR tries to correct the problem of nushell scripts being made executable on Windows systems. In order to do this, these steps need to take place.

  1. assoc .nu=nuscript
  2. ftype nuscript=C:\path\to\nu.exe '%1' %*
  3. modify the env var PATHEXT by appending ;.NU at the end
     
    Once those steps are done and this PR is landed, one should be able to create a script such as this.
 open im_exe.nu
def main [arg] {
  print $"Hello ($arg)!"
}

Then they should be able to do this to run the nushell script.

 im_exe Nushell
Hello Nushell!

Under-the-hood, nushell is shelling out to cmd.exe in order to run the nushell script.

User-Facing Changes

closes #13020

Tests + Formatting

After Submitting

@fdncred fdncred merged commit f7832c0 into nushell:main Nov 15, 2024
@fdncred fdncred deleted the fix_windows_cmd_assoc_scripts branch November 15, 2024 12:39
@github-actions github-actions bot added this to the v0.101.0 milestone Nov 15, 2024
@fdncred fdncred added the notes:fixes Include the release notes summary in the "Bug fixes" section label Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notes:fixes Include the release notes summary in the "Bug fixes" section

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nu::shell::io_error when trying to run file on windows

1 participant