Skip to content

STDIN not piped when wrapping hls in docker #2045

@aschmois

Description

@aschmois

We have a docker image that contains HLS and prebuilt dependencies. I thought it would be nice to add HLS to this image and have the extension run a script that wraps around it. HLS will run but it looks like stdin is completely ignored. I tried a few different ways with docker-compose -T and docker -i but nothing seems to pipe stdin correctly. Maybe I'm setting this up wrong, or maybe vscode's stdin transport just doesn't support doing this.

This is the wrapping script I built, it's pretty simple. stack is the name of the docker compose container and it's just ubuntu with stack, some prebuilt dependencies, and hls.

#!/usr/bin/env bash
docker-compose up -d stack
# exec docker-compose exec -T stack haskell-language-server-wrapper "$@"
exec docker exec -i "$(docker-compose ps -q stack)" haskell-language-server-wrapper "$@"

The ouput generates as expected, but nothing is piped in so the extension just doesn't work:

[client] run command: "/home/user/projects/example/tools/haskell-language-server-wrapper --lsp"
[client] debug command: "/home/user/projects/example/tools/haskell-language-server-wrapper --lsp"
[client] server cwd: undefined
example_stack_1 is up-to-date
Found "/home/user/projects/example/hie.yaml" for "/home/user/projects/example/a"
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 1.2.0.0, Git revision be2071e985cb417f984ab00a1aad76dee02d6d0b (dirty) x86_64 ghc-8.10.4
Current directory: /home/user/projects/example
Operating system: linux
Arguments: ["--lsp"]
Cradle directory: /home/user/projects/example
Cradle type: Stack

Tool versions found on the $PATH
cabal:		Not found
stack:		2.7.1
ghc:		Not found


Consulting the cradle to get project GHC version...
Project GHC version: 8.10.4
haskell-language-server exe candidates: ["haskell-language-server-8.10.4","haskell-language-server"]
Launching haskell-language-server exe at:/usr/bin/haskell-language-server-8.10.4
haskell-language-server version: 1.2.0.0 (GHC: 8.10.4) (PATH: /usr/bin/haskell-language-server-8.10.4) (GIT hash: be2071e985cb417f984ab00a1aad76dee02d6d0b)
Starting (haskell-language-server)LSP server...
  with arguments: GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = False, argsLogFile = Nothing, argsThreads = 0, argsProjectGhcVersion = False}
  with plugins: [PluginId "pragmas",PluginId "floskell",PluginId "fourmolu",PluginId "tactics",PluginId "ormolu",PluginId "stylish-haskell",PluginId "retrie",PluginId "brittany",PluginId "class",PluginId "haddockComments",PluginId "eval",PluginId "importLens",PluginId "refineImports",PluginId "moduleName",PluginId "hlint",PluginId "splice",PluginId "ghcide-hover-and-symbols",PluginId "ghcide-code-actions-imports-exports",PluginId "ghcide-code-actions-type-signatures",PluginId "ghcide-code-actions-bindings",PluginId "ghcide-code-actions-fill-holes",PluginId "ghcide-completions",PluginId "ghcide-type-lenses",PluginId "ghcide-core"]
  in directory: /home/user/projects/example
 Starting LSP server...
If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions