From 45af63f9b6aa28fc59553dda149d3a6a17387c1c Mon Sep 17 00:00:00 2001 From: Konstantin Ulitin Date: Fri, 16 Feb 2018 18:55:23 +0300 Subject: [PATCH] JS debugger: remove obsolete ProcessHandlerWrapper class it's not required because process is stopped asynchronously now --- .../debugger-ui/src/ProcessHandlerWrapper.kt | 89 ------------------- 1 file changed, 89 deletions(-) delete mode 100644 platform/script-debugger/debugger-ui/src/ProcessHandlerWrapper.kt diff --git a/platform/script-debugger/debugger-ui/src/ProcessHandlerWrapper.kt b/platform/script-debugger/debugger-ui/src/ProcessHandlerWrapper.kt deleted file mode 100644 index 196b52512831..000000000000 --- a/platform/script-debugger/debugger-ui/src/ProcessHandlerWrapper.kt +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jetbrains.debugger - -import com.intellij.execution.KillableProcess -import com.intellij.execution.process.ProcessAdapter -import com.intellij.execution.process.ProcessEvent -import com.intellij.execution.process.ProcessHandler -import com.intellij.xdebugger.XDebugProcess -import org.jetbrains.rpc.LOG - -class ProcessHandlerWrapper(private val debugProcess: XDebugProcess, private val handler: ProcessHandler) : ProcessHandler(), KillableProcess { - init { - if (handler.isStartNotified) { - super.startNotify() - } - - handler.addProcessListener(object : ProcessAdapter() { - override fun startNotified(event: ProcessEvent) { - super@ProcessHandlerWrapper.startNotify() - } - - override fun processTerminated(event: ProcessEvent) { - notifyProcessTerminated(event.exitCode) - } - }) - } - - override fun isSilentlyDestroyOnClose() = handler.isSilentlyDestroyOnClose - - override fun startNotify() { - handler.startNotify() - } - - override fun destroyProcessImpl() { - stop(true) - } - - override fun detachProcessImpl() { - stop(false) - } - - private fun stop(destroy: Boolean) { - fun stopProcess(destroy: Boolean) { - if (destroy) { - handler.destroyProcess() - } - else { - handler.detachProcess() - } - } - - debugProcess.stopAsync() - .done { stopProcess(destroy) } - .rejected { - try { - LOG.error(it) - } - finally { - stopProcess(destroy) - } - } - } - - override fun detachIsDefault() = handler.detachIsDefault() - - override fun getProcessInput() = handler.processInput - - override fun canKillProcess() = handler is KillableProcess && handler.canKillProcess() - - override fun killProcess() { - if (handler is KillableProcess) { - handler.killProcess() - } - } -} \ No newline at end of file