Is there a way to set argv[0]
in a Haskell program (say, one compiled with ghc)?
I found the getProgName
and withProgName
functions in System.Environment, but it doesn't seem to change what ps
reports (Ubuntu).
import System.Environment
main =
do name <- getProgName
putStrLn $ "Hello, my name is " ++ name
withProgName "other" $ do
newname <- getProgName
putStrLn $ "Name now set to " ++ newname
putStrLn "What is your name: "
-- allow time to run ps
ans <- getLine
putStrLn $ "Pleased to meet you, " ++ ans
ps
reports, so I wouldn't be surprised if GHC does not support this. – Blasto