How to exit from clearcase view and not from script?

六月ゝ 毕业季﹏ 提交于 2019-12-07 04:09:25
VonC

I would rather try without using cleartool setview.

Access your data directly in the full path of your view: /view/XYZ/vobs/yourVob
That way:

  • you don't have to exit any process in your script.
  • you avoid creating a sub-shell when you call setview in your script: that explain why your path is incorrect.
    See "Python and ClearCase setview" for an example of the kind of issue that sub-shell causes.

That obviously assume your dynamic view is already started (if not, cleartool startview).


For a better understanding of why your shell cannot be completely executed when using setview, see "Setting into a view from a shell script does not process the remaining commands in the script"

In the above script, any commands that appear after the execution of cleartool setview XYZ are not processed because a shell is spawned with exec(), which replaces the current program with a new program.
This means current process 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 XYZ.
Hence, none of the commands are processed beyond the point of invocation of the setview.

In your case, the cd /ccase/src is never called.

If you work directly with the full path of your started view, you don't create any sub-shell and don't have that issue: your last cd /ccase/src will be called.

1- Use:

cleartool startview <your_view_tag>

instead of

cleartool setview <your_view_tag>

Then you will be able to access your view simply using:

cd /view/<your_view_tag>/<your_vob_name>
touch <yourfile>

and eventually do the same thing with another view and using the same or an other vob. This method will not open an other shell and you will get rid of any exit command in your script

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!