cli icon indicating copy to clipboard operation
cli copied to clipboard

Dapr run does not pass through keyboard input to client process

Open cveld opened this issue 3 years ago • 3 comments

Expected Behavior

I am running a Blazor Server app with the following command-line for enabling hot reload from within a vscode integrated PowerShell terminal:

dapr run --app-id blazordaprdemo --components-path "C:\somepath\Components" --app-port 5000 -- dotnet watch --project "C:\somepath\BlazorDaprDemo"

In appsettings.json I have specified "Urls": "http://localhost:5000". Although dotnet watch run is accepting --url <url>, this is not accepted by dotnet watch.

To enforce a restart one would like to press CTRL-R. And in the case of a rude edit, the hot reload infrastructure wants to get user input.

Actual Behavior

Unfortunately I am not able to send any keyboard input to this dotnet watch process.

dapr --version
CLI version: 1.7.1 
Runtime version: 1.7.2

Running on Windows 11. vscode 1.67.0 PowerShell extension v2022.5.1

Release Note

RELEASE NOTE: FIX Within Dapr run keyboard input is passed through to client process.

cveld avatar May 09 '22 14:05 cveld

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.

dapr-bot avatar Jun 08 '22 15:06 dapr-bot

I adjusted the problem.

introduce

  1. dotnet watch does not support the parameters of --urls, because the dotnet CLI does not support it (this is not a problem with dapr).
  2. dotnet run command supports the use of --urls parameters.
I:\source\ERP\Admin.NET\Admin.NET.Web.Entry>dapr run --app-id blazordaprdemo --components-path "X:\somepath\Components" --app-port 8089 -- dotnet run  --urls http://*:8089 --project "X:\Users\HueiFeng\testwebapi\testwebapi.csproj"
Starting Dapr with id blazordaprdemo. HTTP Port: 16695. gRPC Port: 16696
time="2022-06-11T16:52:41.1577957+08:00" level=info msg="starting Dapr Runtime -- version 1.7.4 -- commit 9b3512921bb52af190a2474f3d31f39a1a7a9879" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T16:52:41.1607944+08:00" level=info msg="log level set to: info" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T16:52:41.1607944+08:00" level=info msg="metrics server started on :16697/" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.metrics type=log ver=1.7.4
time="2022-06-11T16:52:41.164793+08:00" level=info msg="standalone mode configured" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T16:52:41.164793+08:00" level=info msg="app id: blazordaprdemo" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T16:52:41.1657943+08:00" level=info msg="mTLS is disabled. Skipping certificate request and tls validation" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T16:52:41.173794+08:00" level=info msg="local service entry announced: blazordaprdemo -> 192.168.100.203:16702" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.contrib type=log ver=1.7.4
time="2022-06-11T16:52:41.1747944+08:00" level=info msg="Initialized name resolution to mdns" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T16:52:41.1757961+08:00" level=info msg="loading components" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T16:52:41.1757961+08:00" level=info msg="waiting for all outstanding components to be processed" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T16:52:41.1757961+08:00" level=info msg="all outstanding components processed" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T16:52:41.1757961+08:00" level=info msg="gRPC proxy enabled" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T16:52:41.1773349+08:00" level=info msg="enabled gRPC tracing middleware" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime.grpc.api type=log ver=1.7.4
time="2022-06-11T16:52:41.1773349+08:00" level=info msg="enabled gRPC metrics middleware" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime.grpc.api type=log ver=1.7.4
time="2022-06-11T16:52:41.1773349+08:00" level=info msg="API gRPC server is running on port 16696" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T16:52:41.1783152+08:00" level=info msg="enabled metrics http middleware" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime.http type=log ver=1.7.4
time="2022-06-11T16:52:41.1783152+08:00" level=info msg="enabled tracing http middleware" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime.http type=log ver=1.7.4
time="2022-06-11T16:52:41.1783152+08:00" level=info msg="http server is running on port 16695" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T16:52:41.1793155+08:00" level=info msg="The request body size parameter is: 4" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T16:52:41.1793155+08:00" level=info msg="enabled gRPC tracing middleware" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime.grpc.internal type=log ver=1.7.4
time="2022-06-11T16:52:41.1793155+08:00" level=info msg="enabled gRPC metrics middleware" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime.grpc.internal type=log ver=1.7.4
time="2022-06-11T16:52:41.1803141+08:00" level=info msg="internal gRPC server is running on port 16702" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T16:52:41.1803141+08:00" level=info msg="application protocol: http. waiting on port 8089.  This will block until the app is listening on that port." app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
== APP == 正在生成...
Updating metadata for app command: dotnet run --urls http://*:8089 --project X:\Users\HueiFeng\testwebapi\testwebapi.csproj
You're up and running! Both Dapr and your app logs will appear here.

== APP == info: Microsoft.Hosting.Lifetime[14]
== APP ==       Now listening on: http://[::]:8089
== APP == info: Microsoft.Hosting.Lifetime[0]
== APP ==       Application started. Press Ctrl+C to shut down.
== APP == info: Microsoft.Hosting.Lifetime[0]
== APP ==       Hosting environment: Development
== APP == info: Microsoft.Hosting.Lifetime[0]
== APP ==       Content root path: X:\Users\HueiFeng\testwebapi\

3.dotnet watch Hot reload Also seems to be normal.

I:\source\ERP\Admin.NET\Admin.NET.Web.Entry>dapr run --app-id blazordaprdemo --components-path "X:\somepath\Components" --app-port 5119 -- dotnet watch --project "X:\Users\HueiFeng\testwebapi\testwebapi.csproj"
Starting Dapr with id blazordaprdemo. HTTP Port: 19487. gRPC Port: 19488
time="2022-06-11T17:00:28.460823+08:00" level=info msg="starting Dapr Runtime -- version 1.7.4 -- commit 9b3512921bb52af190a2474f3d31f39a1a7a9879" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T17:00:28.4635484+08:00" level=info msg="log level set to: info" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T17:00:28.4646272+08:00" level=info msg="metrics server started on :19489/" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.metrics type=log ver=1.7.4
time="2022-06-11T17:00:28.4696696+08:00" level=info msg="standalone mode configured" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T17:00:28.4702062+08:00" level=info msg="app id: blazordaprdemo" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T17:00:28.4731412+08:00" level=info msg="mTLS is disabled. Skipping certificate request and tls validation" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T17:00:28.4838379+08:00" level=info msg="local service entry announced: blazordaprdemo -> 192.168.100.203:19493" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.contrib type=log ver=1.7.4
time="2022-06-11T17:00:28.4843697+08:00" level=info msg="Initialized name resolution to mdns" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T17:00:28.4849028+08:00" level=info msg="loading components" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T17:00:28.4854355+08:00" level=info msg="waiting for all outstanding components to be processed" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T17:00:28.4859774+08:00" level=info msg="all outstanding components processed" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T17:00:28.4859774+08:00" level=info msg="gRPC proxy enabled" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T17:00:28.4865066+08:00" level=info msg="enabled gRPC tracing middleware" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime.grpc.api type=log ver=1.7.4
time="2022-06-11T17:00:28.4870435+08:00" level=info msg="enabled gRPC metrics middleware" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime.grpc.api type=log ver=1.7.4
time="2022-06-11T17:00:28.4870435+08:00" level=info msg="API gRPC server is running on port 19488" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T17:00:28.4875733+08:00" level=info msg="enabled metrics http middleware" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime.http type=log ver=1.7.4
time="2022-06-11T17:00:28.4881047+08:00" level=info msg="enabled tracing http middleware" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime.http type=log ver=1.7.4
time="2022-06-11T17:00:28.4881047+08:00" level=info msg="http server is running on port 19487" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T17:00:28.4886359+08:00" level=info msg="The request body size parameter is: 4" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T17:00:28.4892706+08:00" level=info msg="enabled gRPC tracing middleware" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime.grpc.internal type=log ver=1.7.4
time="2022-06-11T17:00:28.4951406+08:00" level=info msg="enabled gRPC metrics middleware" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime.grpc.internal type=log ver=1.7.4
time="2022-06-11T17:00:28.4956697+08:00" level=info msg="internal gRPC server is running on port 19493" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T17:00:28.4956697+08:00" level=info msg="application protocol: http. waiting on port 5119.  This will block until the app is listening on that port." app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
Updating metadata for app command: dotnet watch --project X:\Users\HueiFeng\testwebapi\testwebapi.csproj
You're up and running! Both Dapr and your app logs will appear here.

== APP == dotnet watch 🔥 Hot reload enabled. For a list of supported edits, see https://aka.ms/dotnet/hot-reload.
== APP ==   💡 Press "Ctrl + R" to restart.
== APP == dotnet watch 🔧 Building...
== APP ==   正在确定要还原的项目…
== APP ==   所有项目均是最新的,无法还原。
== APP ==   testwebapi -> X:\Users\HueiFeng\testwebapi\bin\Debug\net6.0\testwebapi.dll
== APP == dotnet watch 🚀 Started
== APP == info: Microsoft.Hosting.Lifetime[14]
== APP ==       Now listening on: https://localhost:7154
time="2022-06-11T17:00:32.2367234+08:00" level=info msg="application discovered on port 5119" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T17:00:32.2383241+08:00" level=warning msg="[DEPRECATION NOTICE] Adding a default content type to incoming service invocation requests is deprecated and will be removed in the future. See https://docs.dapr.io/operations/support/support-preview-features/ for more details. You can opt into the new behavior today by setting the configuration option `ServiceInvocation.NoDefaultContentType` to true." app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
== APP == info: Microsoft.Hosting.Lifetime[14]
== APP ==       Now listening on: http://localhost:5119
== APP == info: Microsoft.Hosting.Lifetime[0]
== APP ==       Application started. Press Ctrl+C to shut down.
== APP == info: Microsoft.Hosting.Lifetime[0]
== APP ==       Hosting environment: Development
== APP == info: Microsoft.Hosting.Lifetime[0]
== APP ==       Content root path: X:\Users\HueiFeng\testwebapi\
time="2022-06-11T17:00:32.4576093+08:00" level=info msg="application configuration loaded" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T17:00:32.4585452+08:00" level=info msg="actors: state store is not configured - this is okay for clients but services with hosted actors will fail to initialize!" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T17:00:32.4612279+08:00" level=info msg="actor runtime started. actor idle timeout: 1h0m0s. actor scan interval: 30s" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime.actor type=log ver=1.7.4
time="2022-06-11T17:00:32.4617551+08:00" level=info msg="dapr initialized. Status: Running. Init Elapsed 3992.0855ms" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime type=log ver=1.7.4
time="2022-06-11T17:00:32.4834604+08:00" level=info msg="placement tables updated, version: 0" app_id=blazordaprdemo instance=DESKTOP-9CS0C5M scope=dapr.runtime.actor.internal.placement type=log ver=1.7.4
== APP == dotnet watch ⌚ File changed: X:\Users\HueiFeng\testwebapi\Program.cs.
== APP == dotnet watch 🔥 Hot reload of changes succeeded.
== APP == dotnet watch ⌚ File changed: X:\Users\HueiFeng\testwebapi\Program.cs.
== APP == dotnet watch 🔥 Hot reload of changes succeeded.

4.I think you said should be a dotnet watch interaction.

 Do you want to restart your app - Yes (y) / No (n) / Always (a) / Never (v)?

I saw the dotnet/SDK, seems to pass Add an environment variable, can temporarily solve the problem. see: https://github.com/dotnet/sdk/pull/23280/files

Summary

According to the customer's description, currently 'dapr CLI' does not support interactive input and we need to consider whether to add this feature.

dotnet watch see: https://docs.microsoft.com/en-us/aspnet/core/tutorials/dotnet-watch?view=aspnetcore-6.0

cc @mukundansundar @yaron2

hueifeng avatar Jun 11 '22 09:06 hueifeng

Triaging this for v1.9

mukundansundar avatar Jul 13 '22 05:07 mukundansundar