Skip to content

Set runtime config values for path to executing script #49330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 11, 2025

Conversation

chsienki
Copy link
Member

Closes #49184

I had to update the test infrastructure slightly to enable one of the tests I added. I did that in the second commit so you can see it separate from the actual implementation.

chsienki added 2 commits June 10, 2025 14:39
- Add output encoding option to tests to capture stdout
- Update test to specify encoding
@Copilot Copilot AI review requested due to automatic review settings June 10, 2025 21:41
@chsienki chsienki added the Area-run-file Items related to the "dotnet run <file>" effort label Jun 10, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR sets runtime configuration values for the path to the executing script and updates tests to verify the new behavior.

  • Updated the project file generation to include runtime configuration options for file and directory paths.
  • Extended test cases to validate different scenarios including relative paths, paths with spaces, and Unicode characters.
  • Added support for configuring standard output encoding in test commands and command implementations.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/dotnet.Tests/CommandTests/Run/RunFileTests.cs Added ItemGroup elements for runtime config options and multiple new tests covering various path scenarios.
test/Microsoft.NET.TestFramework/Commands/TestCommand.cs Introduced StandardOutputEncoding property and fluent setter to allow customizing output encoding in tests.
src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs Updated project file generation to include runtime configuration options for entry point paths.
src/Cli/Microsoft.DotNet.Cli.Utils/ICommand.cs Added interface method for setting standard output encoding.
src/Cli/Microsoft.DotNet.Cli.Utils/Command.cs Implemented StandardOutputEncoding to correctly set the process output encoding.
src/Cli/Microsoft.DotNet.Cli.Utils/BuiltInCommand.cs Introduced a stub for StandardOutputEncoding that currently throws NotImplementedException.

@chsienki
Copy link
Member Author

@dotnet/run-file for reviews please :)

Co-authored-by: Jan Jones <jan.jones.cz@gmail.com>
@jaredpar
Copy link
Member

@marcpopMSFT can you merge this?

@KalleOlaviNiemitalo
Copy link
Contributor

KalleOlaviNiemitalo commented Jun 11, 2025

AppContext is nicer than environment variables, which could propagate to child processes for which they are not appropriate.

@marcpopMSFT
Copy link
Member

The watch, container, and completion failures are all known. Merging per request.

@marcpopMSFT marcpopMSFT merged commit 1a2c7af into dotnet:main Jun 11, 2025
19 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-run-file Items related to the "dotnet run <file>" effort
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set runtime configuration values containing the entry-point file path and directory when running file-based apps
7 participants