[Question] Why would "write |1: The pipe is being closed" be happening on Windows when my app works fine on Linux?

polaris · · 470 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>The issue I&#39;m having is mentioned on <a href="https://github.com/FactoKit/FactoCord/issues/3" rel="nofollow">https://github.com/FactoKit/FactoCord/issues/3</a></p> <p>For some reason I can&#39;t get StdinPipe working correctly on windows but it works perfectly fine on linux and I&#39;m unsure why.</p> <hr/>**评论:**<br/><br/>epiris: <pre><p>Need more info like a link to where in code it happens, sounds line an os.Exec on a prog that is exiting without reading from stdin fully or at all.. if so show me the exec statement. Likely need to change how you exec the program in windows or are getting permissions issues etc.</p></pre>FMCore: <pre><p>If I were to type in the console while the bot was connected, these lines trigger the error</p> <p><a href="https://github.com/FactoKit/FactoCord/blob/master/main.go#L81-L92" rel="nofollow">https://github.com/FactoKit/FactoCord/blob/master/main.go#L81-L92</a></p> <p>If I were to send a message on discord while the bot was connected, these lines would trigger an error: <a href="https://github.com/FactoKit/FactoCord/blob/master/main.go#L157-L161" rel="nofollow">https://github.com/FactoKit/FactoCord/blob/master/main.go#L157-L161</a></p></pre>epiris: <pre><p>You didn&#39;t include the command. Reduce all the noise into the simplest case is my best suggestion. Windows almost always boils down to acls or cmd syntax / availability with these sort of things, also I would capture the exit code, all stderr / stdout to teewriters for debugging.</p></pre>Kraigius: <pre><p>I personally won&#39;t be able to help unless you reduce your code to the smallest reproducible case, we won&#39;t all set up a Factorio game server and create a Discord app to test it.</p> <p>Although I don&#39;t think that&#39;s related to the error and I&#39;m not the most experienced user when it comes to spotting race condition but you seems to have one with the Pipe variable here. If I&#39;m wrong I hope someone will correct me so I can learn and I&#39;ll edit my message accordingly.</p> <p>Pipe is a global in main.go. It&#39;s initialize inside a goroutine on line 61. It&#39;s used in a second goroutine on line 88 (no guarantee that line 61 was executed at this point), line 105 will execute before the 2 goroutine as it&#39;s synchronous code and so line 112 will pass the address of an uninitialized pipe to the admin.P global.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

470 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传