mirror of
https://github.com/clearml/wexpect-venv
synced 2025-01-31 02:46:59 +00:00
[FIX] TEST of test_command_list_split, escape character change; [FIX] process killing. Based on issue: Pywin32-224 TerminateProcess Function Moved #5
This commit is contained in:
parent
01898e5087
commit
d3caa273d6
@ -7,7 +7,7 @@ import os
|
||||
|
||||
here = os.path.dirname(os.path.abspath(__file__))
|
||||
wexpectPath = os.path.dirname(here)
|
||||
sys.path.insert(0, wexpectPath)
|
||||
#sys.path.insert(0, wexpectPath)
|
||||
|
||||
import wexpect
|
||||
|
||||
|
@ -29,10 +29,10 @@ class SplitCommandLineTestCase(PexpectTestCase.PexpectTestCase):
|
||||
assert len(wexpect.split_command_line(r'one two')) == 2
|
||||
assert len(wexpect.split_command_line(r'one two')) == 2
|
||||
assert len(wexpect.split_command_line(r'one two')) == 2
|
||||
assert len(wexpect.split_command_line(r'one\ one')) == 1
|
||||
assert len(wexpect.split_command_line(r'one^ one')) == 1
|
||||
assert len(wexpect.split_command_line('\'one one\'')) == 1
|
||||
assert len(wexpect.split_command_line(r'one\"one')) == 1
|
||||
assert len(wexpect.split_command_line(r'This\' is a\'\ test')) == 3
|
||||
assert len(wexpect.split_command_line(r"This^' is a^'^ test")) == 3
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
@ -1855,6 +1855,9 @@ class spawn_windows (spawn_unix, object):
|
||||
def kill(self, sig):
|
||||
"""Sig == sigint for ctrl-c otherwise the child is terminated."""
|
||||
|
||||
if not self.isalive():
|
||||
return
|
||||
|
||||
if sig == signal.SIGINT:
|
||||
self.wtty.sendintr()
|
||||
else:
|
||||
@ -2108,8 +2111,8 @@ class Wtty:
|
||||
|
||||
def terminate_child(self):
|
||||
"""Terminate the child process."""
|
||||
|
||||
win32api.win32process.TerminateProcess(self.__childProcess, 1)
|
||||
win32api.TerminateProcess(self.__childProcess, 1)
|
||||
# win32api.win32process.TerminateProcess(self.__childProcess, 1)
|
||||
|
||||
def createKeyEvent(self, char):
|
||||
"""Creates a single key record corrosponding to
|
||||
@ -2842,7 +2845,6 @@ def join_args(args):
|
||||
return ' '.join(commandline)
|
||||
|
||||
def split_command_line(command_line, escape_char = '^'):
|
||||
|
||||
"""This splits a command line into a list of arguments. It splits arguments
|
||||
on spaces, but handles embedded quotes, doublequotes, and escaped
|
||||
characters. It's impossible to do this with a regular expression, so I
|
||||
|
Loading…
Reference in New Issue
Block a user