gpt4 book ai didi

Python 和 ClearCase setview

转载 作者:行者123 更新时间:2023-11-28 23:02:06 28 4
gpt4 key购买 nike

我想从 python 脚本设置为 clearcase View ,然后在该 View 中执行命令。我已尝试使用此处概述的各种方法:

subprocess

但是我还没有成功。有谁知道如何做到这一点?

最佳答案

我不建议设置 View ,因为 setview本身产生一个新进程。
我真的更喜欢在 starting the view 之后使用 /view/viewTag/aVob/... (cleartool startview viewTag )

在我看来,“生成过程”问题使所有事情变得过于复杂,并解释了为什么您有这样的技术说明:

Any commands that appear after the execution of cleartool setview cmview are not processed because a shell is spawned off with exec(), which replaces the current program with a new program.

This means current process's text and code segments, which in this case is the script that contains all the commands, is replaced by the program getting executed, which is the shell invoked by running cleartool setview cmview.
Hence, none of the commands are processed beyond the point of invocation of the setview.

The -exec variable will start a subshell process and invoke the specified command in the dynamic view specified. Control is then returned to the parent shell once the command has finished.
The -exec will not set the view in the parent shell process.
The -exec spawned subshell will inherit the Environment variables of the parent shell process; however, the Environment variables created in the child shell will not pass back into the parent shell.

因此,如果您真的想使用setview,您可以(我自己没有直接测试):

  • 有一个 python 脚本调用 setview
  • 但是 setview 调用将带有一个 -exec 参数作为另一个 python 脚本(在 /vobs 时做你想做的事配置了所述 Collection View 的内容。

关于Python 和 ClearCase setview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10252436/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com