Home Download Buy Blog Forum Support

Can not kill windows shell process : Access denied

Can not kill windows shell process : Access denied

Postby dataxa on Tue Jun 17, 2014 9:12 am

Developing and testing on Windows 7, created Sublime Text 3 plugin and opened subprocess:
Code: Select all
proc = subprocess.Popen(["node" , myJSFile], cwd=dirname, bufsize=-1, stdout=subprocess.PIPE , stderr=subprocess.PIPE , shell=True , universal_newlines=True)

NB: I need the shell=true.
Subprocess runs nicely but when I try to kill it by sending it SIGTERM:
Code: Select all
os.kill(proc.pid , signal.SIGTERM)

I get the following error:
Code: Select all
Traceback (most recent call last):
  File "D:\Portable\Sublime Text 3\sublime_plugin.py", line 549, in run_
    return self.run(edit)
  File "D:\Portable\Sublime Text 3\Data\Packages\NodeRunner\NodeRunner.py", line 50, in run
  File "D:\Portable\Sublime Text 3\Data\Packages\NodeRunner\NodeRunner.py", line 98, in terminateNode
    os.kill(proc.pid , signal.SIGTERM)
PermissionError: [WinError 5] Access is denied

Currently, I can kill the process with:
Code: Select all
subprocess.Popen("taskkill /F /T /PID %i"%proc.pid , shell=True)

But I dont like this brute force solution as my process does not get proper sigterm signal for post operations.

I have read lot of google topics about the subject but with no success. Does anyone have any ideas how to solve?
Posts: 2
Joined: Sun Jun 15, 2014 11:37 pm

Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 3 guests