为什么关闭终端窗口并打开一个新窗口有时就是解决方案?
有时,当我调试从命令行运行的程序时,看似明显的更改在我关闭终端窗口、打开一个新窗口并重试之前不会起作用。我在 Mac OS(即 bash)和 Windows 上都发生过这种情况。
这是当明显的解决方案失败时我所做的最后一件事,但我想知道原因。是关于命令行程序在创建某物时“捕获”某物的快照吗?
Sometimes when I'm debugging a program that runs from the command line, a seemingly obvious change doesn't work until I close the terminal window, open a new one, and try again. I've had this happen on both Mac OS (i.e., bash) and Windows.
This is a last-ditch thing I do when obvious solutions fail, but I'd like to know why. Is it something about the command-line program "capturing" a snapshot of something when it's created?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
shell 可以对已知的二进制文件进行哈希处理(因此它们不必搜索路径)。
更改系统范围的环境变量时,您需要启动一个新的 shell 来获取新环境。请注意,仅输入子 shell 是行不通的,因为子进程会从父进程继承其环境
Shells can hash known binaries (so they don't have to search the path for it)
When changing system wide environment variables, you need to start a new shell to get the new environment. Note that just entering a subshell doesn't work as child processes inherit their environments from their parents