Skip to content
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

protoc-gen-ts does not end process in powershell #74

Open
ihl396 opened this issue Oct 21, 2020 · 3 comments
Open

protoc-gen-ts does not end process in powershell #74

ihl396 opened this issue Oct 21, 2020 · 3 comments

Comments

@ihl396
Copy link

ihl396 commented Oct 21, 2020

Summary

The grpc generators creates all the grpc js/ts artifacts in < 2 seconds, but it doesn't end the powershell script execution which can be problematic when it's chained with other npm commands.

Current Versions:

"grpc": "^1.24.3"
"grpc-tools": "^1.9.1"
"grpc_tools_node_protoc_ts": "^5.0.1"

Repro steps:

  1. Create a grpc typescript project
    npm install grpc_tools_node_protoc_ts --save-dev
  2. Create a ./proto directory, use a sample .proto file: https://github.com/blokur/grpc-ts-demo/blob/master/proto/songs.proto
  3. Use this script to generate the proto files:
param (
  [Parameter(Mandatory=$true)][string]$basedir
)
Push-Location $basedir
$FullPath=$PWD

$PROTOGEN_DIR="./src/protogen"
mkdir -force $PROTOGEN_DIR

$PROTOC_GEN_TS_PATH="node_modules/.bin/protoc-gen-ts.cmd"
$GRPC_TOOLS_NODE_PROTOC_PLUGIN="node_modules/.bin/grpc_tools_node_protoc_plugin.cmd"

./node_modules/.bin/grpc_tools_node_protoc `
  --js_out=import_style=commonjs,binary:"$PROTOGEN_DIR" `
  --ts_out="$PROTOGEN_DIR" `
  --grpc_out="$PROTOGEN_DIR" `
  --plugin=protoc-gen-grpc="$FullPath/$GRPC_TOOLS_NODE_PROTOC_PLUGIN" `
  -I ./proto `
  ./proto/*.proto

# TypeScript code generation
./node_modules/.bin/protoc-gen-ts `
  --plugin=protoc-gen-ts="$FullPath/$PROTOC_GEN_TS_PATH" `
  --ts_out="$PROTOGEN_DIR" `
  -I ./proto
  ./proto/*.proto

Pop-Location

Command: build-protos.ps1 -basedir .\<project root>
4. Powershell does not end process after protoc-gen-ts

@agreatfool
Copy link
Owner

Hi @ihl396 ,

I have no windows PC, so it's difficult for me to debug the issue of PowerShell. I would leave this issue open to see is there anybody else could solve your issue.

@favna
Copy link

favna commented Apr 23, 2021

@agreatfool
Copy link
Owner

Oh, good to know

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

No branches or pull requests

3 participants