我对这个问题感到愚蠢,但是这里有.在linux/mac中,只需编写其名称即可在shell中运行可执行文件.你能在windows命令行中做类似的事情吗?
示例:我在目录中dir.我想a.exe在dir/subdir不更改目录subdir或写入的情况下运行文件subdir/a.exe.这可能吗?
在 Ktor 中,我希望实现某种方法来引用 coroutineContext 内的键值对,而无需在方法参数中拖动对对象的引用。基于https://proandroiddev.com/demystifying-coroutinecontext-1ce5b68407ad我编写了我的参考类:
class MyElement(override val key: CoroutineContext.Key<*>, val value: String) : CoroutineContext.Element
class MyKey: CoroutineContext.Key<MyElement>
Run Code Online (Sandbox Code Playgroud)
... // 内部路由:
val key: CoroutineContext.Key<MyElement> = MyKey()
val ele = MyElement(key, "myJWT")
withContext(coroutineContext + ele) {
val notNullEle : MyElement = coroutineContext[ele.key] as MyElement // not null
logger.info(notNullEle.value) // "myJWT"
val shouldNotBeNullEle = coroutineContext[MyKey()]// NULL!
}
val shouldBeNull = coroutineContext[ele.key] // is and should be null
val shouldBeNull2 = coroutineContext[MyKey()] // is and should also be null
Run Code Online (Sandbox Code Playgroud)
当我发送ele.key …