Implemented ProcessLauncher on Windows.
This commit is contained in:
@@ -450,4 +450,31 @@ Java_net_rubygrapefruit_platform_internal_jni_WindowsConsoleFunctions_clearToEnd
|
||||
}
|
||||
}
|
||||
|
||||
void uninheritStream(JNIEnv *env, DWORD stdInputHandle, jobject result) {
|
||||
HANDLE streamHandle = GetStdHandle(stdInputHandle);
|
||||
if (streamHandle == NULL) {
|
||||
// We're not attached to a stdio (eg Desktop application). Ignore.
|
||||
return;
|
||||
}
|
||||
if (streamHandle == INVALID_HANDLE_VALUE) {
|
||||
mark_failed_with_errno(env, "could not get std handle", result);
|
||||
return;
|
||||
}
|
||||
boolean ok = SetHandleInformation(streamHandle, HANDLE_FLAG_INHERIT, 0);
|
||||
if (!ok) {
|
||||
mark_failed_with_errno(env, "could not change std handle", result);
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_net_rubygrapefruit_platform_internal_jni_WindowsHandleFunctions_markStandardHandlesUninheritable(JNIEnv *env, jclass target, jobject result) {
|
||||
uninheritStream(env, STD_INPUT_HANDLE, result);
|
||||
uninheritStream(env, STD_OUTPUT_HANDLE, result);
|
||||
uninheritStream(env, STD_ERROR_HANDLE, result);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_net_rubygrapefruit_platform_internal_jni_WindowsHandleFunctions_restoreStandardHandles(JNIEnv *env, jclass target, jobject result) {
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user