From: | "Gary Doades" <gpd(at)gpdnet(dot)co(dot)uk> |
---|---|
To: | pgsql-hackers-win32 <pgsql-hackers-win32(at)postgresql(dot)org> |
Subject: | Re: pg_ctl start broken on windows |
Date: | 2004-06-09 18:43:29 |
Message-ID: | 40C76861.31040.3438FD15@localhost |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers-win32 |
You might want to try ShellExecute first before delving into
CreateProcess
e.g.
ShellExecute(GetDesktopWindow(), "open", "cmd.exe", "arg1 arg2 arg3", NULL, SW_SHOWNORMAL);
The path to the executable (e.g. cmd.exe) must be fully qualified and
use the .exe extension in this case. Also you must use backslashes.
You will need to use backslashes if you use CreateProcess anyway.
If this doesn't work I can give you an example for CreateProcess.
Regards,
Gary.
On 9 Jun 2004 at 14:07, Andrew Dunstan wrote:
> Bruce Momjian wrote:
>
> >Andrew Dunstan wrote:
> >
> >
> >>>>C:\msys\1.0\local\pgsql>bin\pg_ctl -D data -l logfile start
> >>>>'C:/msys/1.0/local/pgsql/bin/postmaster.exe" < nul >>"logfile' is not recognized as an internal or external command, operable program or batch file.
> >>>>
> >>>>
> >>>>I think we'll have to bite the bullet and replace that system() call
> >>>>with a direct call to CreateProcess() with the appropriate parameters. I
> >>>>haven't ever done this, so some help from one of the more experienced
> >>>>Windows programmers would be appreciated.
> >>>>
> >>>>
> >>>>
> >>>>
> >>>Yes, I assumed pg_ctl would have such issues. pg_dumpall has them as
> >>>well calling pg_dump.
> >>>
> >>>Here is a strange idea that I am looking for someone to check. According
> >>>to someone, Win32 system just strips off the first and last quotes, and
> >>>that is why it is failing. Try adding a quote to the beginning and end
> >>>of the system string, and leave the existing quote intact. That might
> >>>fix is and if it does I can add this to CVS.
> >>>
> >>>
> >>>
> >>>
> >>>
> >>I'll test to make sure, but I can tell you now it won't work. It will
> >>see the inner quotes and interpret them as part of the command. (I tried
> >>all these variants when I was testing initdb).
> >>
> >>
> >
> >Claudio reported it worked for pg_dumpall for single quotes:
> >
> > system(''cmd.exe' 'arg1' 'arg2'');
> >
> >What exactly is the logic of the stripping?
> >
> >In fact, pg_ctl is wrong because it is using double quotes instead of
> >the safer single quotes. Let me make that change.
> >
> >
>
> No. It chokes on forward slashes.
>
> and it tries to make a log file called 'logfile' (quotes included).
>
> I really don't see what the problem is with calling CreateProcess - it
> should only be a few lines of code unless I'm much mistaken, and would
> get us out of this setup that is really fragile at best.
>
> cheers
>
> andrew
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2004-06-09 19:43:16 | Re: pg_ctl start broken on windows |
Previous Message | Andrew Dunstan | 2004-06-09 18:07:45 | Re: pg_ctl start broken on windows |