Skip to content

Commit 251ed4c

Browse files
committed
Fix allow_stdin=false after rebase
1 parent 91c157e commit 251ed4c

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

src/main/kotlin/org/jetbrains/kotlinx/jupyter/message_types.kt

+11
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,17 @@ class ExecuteReply(
243243

244244
@SerialName("user_expressions")
245245
val userExpressions: Map<String, JsonElement> = mapOf(),
246+
247+
@SerialName("ename")
248+
val errorName: String? = null,
249+
250+
@SerialName("evalue")
251+
val errorValue: String? = null,
252+
253+
@SerialName("traceback")
254+
val traceback: List<String>? = null,
255+
256+
val additionalInfo: JsonObject? = null,
246257
) : MessageContent()
247258

248259
@Serializable

src/main/kotlin/org/jetbrains/kotlinx/jupyter/protocol.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ fun JupyterConnection.evalWithIO(repl: ReplForJupyter, srcMessage: Message, body
428428
System.setErr(PrintStream(forkedError, false, "UTF-8"))
429429

430430
val `in` = System.`in`
431-
val allowStdIn = srcMessage.content?.boolean("allow_stdin") ?: true
431+
val allowStdIn = (srcMessage.content as? ExecuteRequest)?.allowStdin ?: true
432432
System.setIn(if (allowStdIn) stdinIn else DisabledStdinInputStream)
433433
try {
434434
return try {

src/test/kotlin/org/jetbrains/kotlinx/jupyter/test/executeTests.kt

+3-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import org.jetbrains.kotlinx.jupyter.compiler.util.SerializedCompiledScriptsData
2020
import org.jetbrains.kotlinx.jupyter.jsonObject
2121
import org.junit.jupiter.api.Assertions.assertEquals
2222
import org.junit.jupiter.api.Assertions.assertNull
23-
import org.junit.jupiter.api.Assertions.assertTrue
2423
import org.junit.jupiter.api.Test
2524
import org.junit.jupiter.api.Timeout
2625
import org.zeromq.ZMQ
@@ -82,7 +81,7 @@ class ExecuteTests : KernelServerTestsBase() {
8281
val shell = this.shell!!
8382
val ioPub = this.ioPub!!
8483
val stdin = this.stdin!!
85-
shell.sendMessage(MessageType.EXECUTE_REQUEST, content = ExecuteRequest(code))
84+
shell.sendMessage(MessageType.EXECUTE_REQUEST, content = ExecuteRequest(code, allowStdin = allowStdin))
8685
inputs.forEach {
8786
stdin.sendMessage(MessageType.INPUT_REPLY, InputReply(it))
8887
}
@@ -124,8 +123,8 @@ class ExecuteTests : KernelServerTestsBase() {
124123
allowStdin = false,
125124
ioPubChecker = {
126125
val msg = it.receiveMessage()
127-
assertEquals("stream", msg.type())
128-
assertTrue((msg.content!!["text"] as String).startsWith("java.io.IOException: Input from stdin is unsupported by the client"))
126+
assertEquals(MessageType.STREAM, msg.type)
127+
assertTrue((msg.content as StreamResponse).text.startsWith("java.io.IOException: Input from stdin is unsupported by the client"))
129128
}
130129
)
131130
}

0 commit comments

Comments
 (0)