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

Problems with pcWorkingDir on macOS #171

Open
k-bx opened this issue Feb 20, 2020 · 1 comment
Open

Problems with pcWorkingDir on macOS #171

k-bx opened this issue Feb 20, 2020 · 1 comment

Comments

@k-bx
Copy link

k-bx commented Feb 20, 2020

Migrating from fpco/typed-process#31

Here's a script that works differently on macOS and Linux.

#!/usr/bin/env stack
{- stack script
     --resolver=lts-15.0
     --package process
-}
{-# LANGUAGE OverloadedStrings #-}

import Control.Concurrent
import System.Exit (ExitCode(..))
import qualified System.Process as P

main :: IO ()
main = do
  let cp0 = P.proc "./webapp" []
      pcWorkingDir = Just "./inner"
      cp = cp0 {P.cwd = pcWorkingDir}
  (minH, moutH, merrH, pHandle) <- P.createProcess_ "startProcess" cp
  putStrLn "> started"
  threadDelay (2 * 1000000)
  putStrLn "> exiting"

The problem is that it succeeds in running a program ./webapp located in ./inner dir on Linux, but fails on macOS. If you put "./inner/webapp" as a path on macOS, it launches it fine.

Dir where you can reproduce this in full: https://github.com/k-bx/playground/tree/master/typed-process-issue-31

@snoyberg
Copy link
Collaborator

As I mentioned in that previous issue, I think this is an inherent difference in Mac vs Linux, though I could be mistaken. I'm worried about trying to fix this one, as it will silently change the behavior of programs on one of these two OSes. If we can do it with a flag, that would be better.

a5ob7r added a commit to a5ob7r/haskellorls that referenced this issue Feb 17, 2021
`System.Process.createProcess` used in goldplate has a difference
between Linux and macOS about relative command path lookup
behavior with changing directory. This causes
`No such file or directory` when runs test using relative command
path. To resolve to this, uses only command name to specify a
command and deploys test command on PATH. Command lookup hebavior
on PATH is same between Linux and macOS.
haskell/process#171
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

2 participants