Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
72996df6
Unverified
Commit
72996df6
authored
Aug 27, 2018
by
Rémi Verschelde
Committed by
GitHub
Aug 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Try closing gracefully before terminating process"
parent
c1f687c6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
39 deletions
+11
-39
os.h
core/os/os.h
+1
-1
os_unix.cpp
drivers/unix/os_unix.cpp
+1
-1
os_unix.h
drivers/unix/os_unix.h
+1
-1
editor_run.cpp
editor/editor_run.cpp
+2
-2
os_windows.cpp
platform/windows/os_windows.cpp
+5
-33
os_windows.h
platform/windows/os_windows.h
+1
-1
No files found.
core/os/os.h
View file @
72996df6
...
...
@@ -256,7 +256,7 @@ public:
virtual
String
get_executable_path
()
const
;
virtual
Error
execute
(
const
String
&
p_path
,
const
List
<
String
>
&
p_arguments
,
bool
p_blocking
,
ProcessID
*
r_child_id
=
NULL
,
String
*
r_pipe
=
NULL
,
int
*
r_exitcode
=
NULL
,
bool
read_stderr
=
false
)
=
0
;
virtual
Error
kill
(
const
ProcessID
&
p_pid
,
const
int
p_max_wait_msec
=
-
1
)
=
0
;
virtual
Error
kill
(
const
ProcessID
&
p_pid
)
=
0
;
virtual
int
get_process_id
()
const
;
virtual
Error
shell_open
(
String
p_uri
);
...
...
drivers/unix/os_unix.cpp
View file @
72996df6
...
...
@@ -329,7 +329,7 @@ Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bo
return
OK
;
}
Error
OS_Unix
::
kill
(
const
ProcessID
&
p_pid
,
const
int
p_max_wait_msec
)
{
Error
OS_Unix
::
kill
(
const
ProcessID
&
p_pid
)
{
int
ret
=
::
kill
(
p_pid
,
SIGKILL
);
if
(
!
ret
)
{
...
...
drivers/unix/os_unix.h
View file @
72996df6
...
...
@@ -91,7 +91,7 @@ public:
virtual
uint64_t
get_ticks_usec
()
const
;
virtual
Error
execute
(
const
String
&
p_path
,
const
List
<
String
>
&
p_arguments
,
bool
p_blocking
,
ProcessID
*
r_child_id
=
NULL
,
String
*
r_pipe
=
NULL
,
int
*
r_exitcode
=
NULL
,
bool
read_stderr
=
false
);
virtual
Error
kill
(
const
ProcessID
&
p_pid
,
const
int
p_max_wait_msec
=
-
1
);
virtual
Error
kill
(
const
ProcessID
&
p_pid
);
virtual
int
get_process_id
()
const
;
virtual
bool
has_environment
(
const
String
&
p_var
)
const
;
...
...
editor/editor_run.cpp
View file @
72996df6
...
...
@@ -196,8 +196,8 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
void
EditorRun
::
stop
()
{
if
(
status
!=
STATUS_STOP
&&
pid
!=
0
)
{
const
int
max_wait_msec
=
GLOBAL_DEF
(
"editor/stop_max_wait_msec"
,
10000
);
OS
::
get_singleton
()
->
kill
(
pid
,
max_wait_msec
);
OS
::
get_singleton
()
->
kill
(
pid
);
}
status
=
STATUS_STOP
;
...
...
platform/windows/os_windows.cpp
View file @
72996df6
...
...
@@ -190,28 +190,6 @@ BOOL WINAPI HandlerRoutine(_In_ DWORD dwCtrlType) {
}
}
BOOL
CALLBACK
_CloseWindowsEnum
(
HWND
hWnd
,
LPARAM
lParam
)
{
DWORD
dwID
;
GetWindowThreadProcessId
(
hWnd
,
&
dwID
);
if
(
dwID
==
(
DWORD
)
lParam
)
{
PostMessage
(
hWnd
,
WM_CLOSE
,
0
,
0
);
}
return
TRUE
;
}
bool
_close_gracefully
(
const
PROCESS_INFORMATION
&
pi
,
const
DWORD
dwStopWaitMsec
)
{
if
(
!
EnumWindows
(
_CloseWindowsEnum
,
pi
.
dwProcessId
))
return
false
;
if
(
WaitForSingleObject
(
pi
.
hProcess
,
dwStopWaitMsec
)
!=
WAIT_OBJECT_0
)
return
false
;
return
true
;
}
void
OS_Windows
::
initialize_debugging
()
{
SetConsoleCtrlHandler
(
HandlerRoutine
,
TRUE
);
...
...
@@ -2464,26 +2442,20 @@ Error OS_Windows::execute(const String &p_path, const List<String> &p_arguments,
return
OK
;
};
Error
OS_Windows
::
kill
(
const
ProcessID
&
p_pid
,
const
int
p_max_wait_msec
)
{
Error
OS_Windows
::
kill
(
const
ProcessID
&
p_pid
)
{
ERR_FAIL_COND_V
(
!
process_map
->
has
(
p_pid
),
FAILED
);
const
PROCESS_INFORMATION
pi
=
(
*
process_map
)[
p_pid
].
pi
;
process_map
->
erase
(
p_pid
);
Error
result
;
if
(
p_max_wait_msec
!=
-
1
&&
_close_gracefully
(
pi
,
p_max_wait_msec
))
{
result
=
OK
;
}
else
{
const
int
ret
=
TerminateProcess
(
pi
.
hProcess
,
0
);
result
=
ret
!=
0
?
OK
:
FAILED
;
}
const
int
ret
=
TerminateProcess
(
pi
.
hProcess
,
0
);
CloseHandle
(
pi
.
hProcess
);
CloseHandle
(
pi
.
hThread
);
return
re
sult
;
}
return
re
t
!=
0
?
OK
:
FAILED
;
}
;
int
OS_Windows
::
get_process_id
()
const
{
return
_getpid
();
...
...
platform/windows/os_windows.h
View file @
72996df6
...
...
@@ -259,7 +259,7 @@ public:
virtual
uint64_t
get_ticks_usec
()
const
;
virtual
Error
execute
(
const
String
&
p_path
,
const
List
<
String
>
&
p_arguments
,
bool
p_blocking
,
ProcessID
*
r_child_id
=
NULL
,
String
*
r_pipe
=
NULL
,
int
*
r_exitcode
=
NULL
,
bool
read_stderr
=
false
);
virtual
Error
kill
(
const
ProcessID
&
p_pid
,
const
int
p_stop_max_wait_msec
=
-
1
);
virtual
Error
kill
(
const
ProcessID
&
p_pid
);
virtual
int
get_process_id
()
const
;
virtual
bool
has_environment
(
const
String
&
p_var
)
const
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment