Subject: [pgAdmin4][Patch]: Background process executor won't run(in case of Backup, restore) in Windows only

From: Surinder Kumar <[email-masked]>
Date: Wed, 21 Sep 2016 16:18:15 +0530

Hi

While working on RM*1391 *I found another issue* 'Backup is not working on
windows".*

The reason is that the process executor which uses subprocess Popen() to
execute job fails when we pass close_fds=True and shell=False in windows.

Now we are settings close_fds=False and shell=True to fix it. These
settings are specific to windows only.

Please review the attached patch.

Thanks,
Surinder Kumar

-- 
Sent via pgadmin-hackers mailing list ([email-masked])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

---

From: Dave Page <[email-masked]>
Date: Thu, 22 Sep 2016 14:05:29 +0100

Can you explain what was broken exactly please? Backups work fine for
me without the patch - and whilst they also work with it, I now get an
ugly command shell window flash up which I didn't before.

On Wed, Sep 21, 2016 at 11:48 AM, Surinder Kumar
<[email-masked]> wrote:
> Hi
>
> While working on RM1391 I found another issue 'Backup is not working on
> windows".
>
> Now we are settings close_fds=False and shell=True to fix it. These settings
> are specific to windows only.
>

-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

---

From: Surinder Kumar <[email-masked]>
Date: Fri, 23 Sep 2016 10:29:26 +0530

​Actually It doesn't broke anywhere, instead It runs successfully. On
debugging I found that it runs the subprocess.Popen() utility but it
doesn't run internally the pg_dump utitliy. On running the same command on
windows cmd prompt it works.
Then on setting parameters close_fds=False and cmd_shell=True, It works.
I ran backup in Google Chrome.

---

From: Dave Page <[email-masked]>
Date: Fri, 23 Sep 2016 09:17:14 +0100

On Fri, Sep 23, 2016 at 5:59 AM, Surinder Kumar
<[email-masked]> wrote:
> Actually It doesn't broke anywhere, instead It runs successfully. On
> debugging I found that it runs the subprocess.Popen() utility but it doesn't
> run internally the pg_dump utitliy. On running the same command on windows
> cmd prompt it works.

It certainly runs pg_dump for me - I see the output in the monitoring
dialogue, and I get a dump file at the end.

I also use Chrome.

---

From: Ashesh Vashi <[email-masked]>
Date: Fri, 23 Sep 2016 13:48:21 +0530

On Fri, Sep 23, 2016 at 1:47 PM, Dave Page <[email-masked]> wrote:

> doesn't
It may differ for different version of python.

--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company
<http://www.enterprisedb.com/>

*http://www.linkedin.com/in/asheshvashi*
<http://www.linkedin.com/in/asheshvashi>

---

From: Dave Page <[email-masked]>
Date: Fri, 23 Sep 2016 09:24:49 +0100

On Fri, Sep 23, 2016 at 9:18 AM, Ashesh Vashi <[email-masked]
> wrote:

> It may differ for different version of python.

Maybe. I'm using 2.7.

Either way, I don't want a command window flashing up unnecessarily.

---

From: Ashesh Vashi <[email-masked]>
Date: Fri, 23 Sep 2016 14:12:26 +0530

On Fri, Sep 23, 2016 at 1:54 PM, Dave Page <[email-masked]> wrote:

>
>
> On Fri, Sep 23, 2016 at 9:18 AM, Ashesh Vashi <
> [email-masked]> wrote:
>
If we set the PYTHON INTERPRETER to run the background process.
i.e. BG_PYTHON_INTERPRETER=c:\Python27\pythonw.exe

We can avoid showing the flashing command window.
I came to this conclusion, because - I tried to hide them using certain
flags, but - it wasn't working well.

--

Thanks & Regards,

Ashesh Vashi