C:\Program Files\MySQL\bin>ghc --make -o mysql_config.exe main.hs
[1 of 1] Compiling Main ( main.hs, main.o )
Linking mysql_config.exe ...
C:\Program Files\MySQL\bin>mysql_config --libs
C:\Program Files\MySQL\bin>mysql_config --goob
C:\Program Files\MySQL\bin>pwhich mysql_config
.\mysql_config.EXE
... yet instead, I should be getting this:
C:\Program Files\MySQL\bin>..\scripts\mysql_config.pl --libs
"C:\Program Files\MySQL/lib/mysqlclient.lib" "wsock32.lib" "advapi32.lib" "user3
2.lib"
C:\Program Files\MySQL\bin>..\scripts\mysql_config.pl --goob
Unknown option: goob
Usage: C:\Program Files\MySQL\scripts\mysql_config.pl [OPTIONS]
Options:
--cflags ["-IC:\Program Files\MySQL/include/mysql" "-D_WINDOWS"
"/MT" "/Zi" "/O2" "/Ob1" "/D" "NDEBUG" "-DDBUG_OFF" "/wd4996"]
--include ["-IC:\Program Files\MySQL/include/mysql"]
--libs ["C:\Program Files\MySQL/lib/mysqlclient.lib" "wsock32.
lib" "advapi32.lib" "user32.lib"]
--libs_r ["C:\Program Files\MySQL/lib/mysqlclient.lib" "wsock32.
lib" "advapi32.lib" "user32.lib"]
--socket [/tmp/mysql.sock]
--port [0]
--version [5.1.45]
--libmysqld-libs ["C:\Program Files\MySQL/lib/mysqlserver.lib" "wsock32.
lib" "advapi32.lib" "user32.lib"]
... so, it looks like I am handling the IO wrong, or else I go directly to the exitWith instead of returning the IO from "return". So, I suppose this is normal behavior, but how do you do BOTH. I guess I should actually be "print"ing the output rather than returning it, then doing the exitWith.
> Date: Thu, 18 Mar 2010 18:56:12 +0000
> Subject: Re: [Haskell-cafe] little help please
> From: nicolas.wu@gmail.com
> To: developer@live.com
> CC: haskell-cafe@haskell.org
>
> This compiles:
>
> import System.Environment(getArgs)
> import System.Process(readProcessWithExitCode)
> import System.Exit(exitWith,ExitCode(ExitSuccess))
>
> main = do
> args <- getArgs
> (ecode,out,err) <- readProcessWithExitCode
> "c:\\Perl64\\bin\\perl.exe" ("C:\\Program
> Files\\MySQL\\scripts\\mysql_config.pl" : args) ""
> if ecode == ExitSuccess
> then return out
> else return err
> exitWith ecode
>
> I had trouble with the spacing you had when I pasted your code, and
> also changed the imports so that ExitSuccess was being imported.
>
> All the best,
>
> Nick
>
> On Thu, Mar 18, 2010 at 6:46 PM, Roderick Ford <developer@live.com> wrote:
> > this will be EASY for you to fix, I am sure... what the heck am I doing
> > wrong:
> > import System.Environment(getArgs)
> > import System.Process(readProcessWithExitCode)
> > import System.Exit(exitWith)
> > main = do
> > args <- getArgs
> > (ecode,out,err) <- readProcessWithExitCode "c:\\Perl64\\bin\\perl.exe"
> > ("C:\\Program Files\\MySQL\\scripts\\mysql_config.pl" : args) ""
> > if ecode == System.Exit.ExitCode.ExitSuccess
> > then return out
> > else return err
> > exitWith ecode
> >
> >
> > _______________________________________________
> > Haskell-Cafe mailing list
> > Haskell-Cafe@haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
> >
> >