commercialhaskell / stack

The Haskell Tool Stack
http://haskellstack.org
BSD 3-Clause "New" or "Revised" License
3.99k stars 844 forks source link

Windows: stty: 'standard input': Inappropriate ioctl for device #5038

Open lehins opened 5 years ago

lehins commented 5 years ago

General summary/comments (optional)

On Windows running stack path as a subprocess results in an error printed to stderr:

stty: 'standard input': Inappropriate ioctl for device

Steps to reproduce

Running normally inside a powershell has no problems:

PS C:\Users\lehins> stack --no-terminal path --project-root
C:\sr\global-project

But when executed as a subprocess

Prelude System.Process> import System.Process
Prelude System.Process> res <- readProcess "stack" ["--version"] ""
Prelude System.Process> putStr res
Version 2.2.0, Git revision b8f8ec203209fccb1a86b9e8705f16125845254b PRE-RELEASE x86_64 hpack-0.31.2
Prelude System.Process> _ <- readProcess "stack" ["path", "--project-root"] ""
stty: 'standard input': Inappropriate ioctl for device
Prelude System.Process> _ <- readProcess "stack" ["--no-terminal", "path", "--project-root"] ""
stty: 'standard input': Inappropriate ioctl for device

There should be no reason that stack path would require anything from stdin.

Expected

No error printed to stderr

Actual

Here is the version with --verbose:

Prelude System.Process> r <- readProcess "stack" ["--no-terminal", "--verbose", "path", "--project-root"] ""
Version 2.2.0, Git revision b8f8ec203209fccb1a86b9e8705f16125845254b PRE-RELEASE x86_64 hpack-0.31.2
stty: 'standard input': Inappropriate ioctl for device
2019-09-24 14:07:06.956615: [debug] Checking for project config at: C:\Users\lehins\stack.yaml
2019-09-24 14:07:06.956615: [debug] Checking for project config at: C:\Users\stack.yaml
2019-09-24 14:07:06.956615: [debug] Checking for project config at: C:\stack.yaml
2019-09-24 14:07:06.956615: [debug] No project config file found, using defaults.
2019-09-24 14:07:06.972240: [debug] SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [Pers
istInt64 1,PersistUTCTime 2019-09-23 20:07:06.9722403 UTC]
2019-09-24 14:07:06.972240: [debug] Run from outside a project, using implicit global project config
2019-09-24 14:07:06.972240: [debug] Using package location completions from a lock file
2019-09-24 14:07:07.206615: [debug] Asking for a supported GHC version
2019-09-24 14:07:07.206615: [debug] Installed tools:
 - msys2-20180531
 - ghc-8.6.5
 - ghc-8.4.3
 - ghc-8.2.2
2019-09-24 14:07:07.222240: [debug] Potential GHC builds: standard
2019-09-24 14:07:07.222240: [debug] Found already installed GHC builds: standard
2019-09-24 14:07:07.222240: [debug] SELECT "id","actual_version","arch","ghc_path","ghc_size","ghc_modified","ghc_pkg_pa
th","runghc_path","haddock_path","cabal_version","global_db","global_db_cache_size","global_db_cache_modified","info","g
lobal_dump" FROM "compiler_cache" WHERE "ghc_path"=?; [PersistText "C:\\Users\\lehins\\AppData\\Local\\Programs\\stack\\
x86_64-windows\\ghc-8.6.5\\bin\\ghc-8.6.5.EXE"]
2019-09-24 14:07:07.300365: [debug] Loaded compiler information from cache
2019-09-24 14:07:07.315990: [debug] Asking for a supported GHC version
2019-09-24 14:07:07.315990: [debug] Resolving package entries
2019-09-24 14:07:07.315990: [debug] Parsing the targets
2019-09-24 14:07:07.315990: [debug] Checking flags
2019-09-24 14:07:07.315990: [debug] SourceMap constructed
2019-09-24 14:07:07.331615: [debug] Starting to execute command inside EnvConfig
2019-09-24 14:07:07.331615: [debug] Checking for project config at: C:\Users\lehins\stack.yaml
2019-09-24 14:07:07.331615: [debug] Checking for project config at: C:\Users\stack.yaml
2019-09-24 14:07:07.347240: [debug] Checking for project config at: C:\stack.yaml
2019-09-24 14:07:07.347240: [debug] No project config file found, using defaults.
2019-09-24 14:07:07.362865: [debug] SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [Pers
istInt64 1,PersistUTCTime 2019-09-23 20:07:07.3628653 UTC]
2019-09-24 14:07:07.362865: [debug] Run from outside a project, using implicit global project config
2019-09-24 14:07:07.362865: [debug] Using package location completions from a lock file
2019-09-24 14:07:07.581615: [debug] Asking for a supported GHC version
2019-09-24 14:07:07.581615: [debug] Installed tools:
 - msys2-20180531
 - ghc-8.6.5
 - ghc-8.4.3
 - ghc-8.2.2
2019-09-24 14:07:07.581615: [debug] Potential GHC builds: standard
2019-09-24 14:07:07.581615: [debug] Found already installed GHC builds: standard
2019-09-24 14:07:07.597240: [debug] SELECT "id","actual_version","arch","ghc_path","ghc_size","ghc_modified","ghc_pkg_pa
th","runghc_path","haddock_path","cabal_version","global_db","global_db_cache_size","global_db_cache_modified","info","g
lobal_dump" FROM "compiler_cache" WHERE "ghc_path"=?; [PersistText "C:\\Users\\lehins\\AppData\\Local\\Programs\\stack\\
x86_64-windows\\ghc-8.6.5\\bin\\ghc-8.6.5.EXE"]
2019-09-24 14:07:07.675365: [debug] Loaded compiler information from cache
2019-09-24 14:07:07.675365: [debug] Asking for a supported GHC version
2019-09-24 14:07:07.675365: [debug] Resolving package entries
2019-09-24 14:07:07.675365: [debug] Parsing the targets
2019-09-24 14:07:07.675365: [debug] Checking flags
2019-09-24 14:07:07.675365: [debug] SourceMap constructed
2019-09-24 14:07:07.706615: [debug] Starting to execute command inside EnvConfig
Prelude System.Process>

Stack version

This issue is present in the latest released version as well, since I observed it on AppVeyor as well as on a local version of Windows 7

PS C:\Users\lehins> stack --version
Version 2.2.0, Git revision b8f8ec203209fccb1a86b9e8705f16125845254b PRE-RELEASE x86_64 hpack-0.31.2

Method of installation

tuomohopia commented 4 years ago

Did you ever get this solved anyhow? I'm getting this error on vscode while running haskell-ide-engine on WIN10.

ndmitchell commented 4 years ago

FWIW, this issue has come up with ghcide, haskell-ide-engine and ghcid - so I think it's somewhat pervasive.