Hi, I am running root using a macro. At the end I want root to exit, but all the commands I tried won't work. TSystem::Exit() and TSystem::Abort() only give: *** Break *** segmentation violation I would be happy if somebody could explain me how I can get root to exit when running a macro ? Thanks for your help, Carsten PS: I saw in roottalk there was a similar question last year, but no answer was given ... only a suggestion how it could be implemented in root. I guess my question is, has anything happend since then ?? or has somebody thought of a workaround ? This is last years answer: >After 'exit()' is called, Cint stops doing anything. It sets >a flag to block any statement as you observed. Because 'exit()' >is normally used when process is terminated, this is a good behavior >in most of the cases. However in ROOT, process is not terminated by >exit(). It simply stops doing anything. > >Fons, >There are 2 options to change this behavior in ROOT. > > - 'exit()' terminates ROOT process > After calling G__process_cmd() in ROOT's command input, > if G__return==G__RETURN_EXIT2 then ROOT terminates. > > - 'exit()' exits from current macro. Next macro will be executed >normally. > After calling G__process_cmd() in ROOT's command input, > reset G__return as G__RETURN_NON. > >Both cases, the change has to be made in ROOT source code. > >Fons, Will you take a look at this? > >Thank you >Masaharu Goto > >Date: Thu, 8 Mar 2001 09:35:29 +0100 (CET) >From: Jiri Chudoba <Jiri.Chudoba@cern.ch> >To: roottalk@pcroot.cern.ch >Subject: [ROOT] Exit from macro > >Hello, > >how can I properly exit from macro? I get a strange behaviour with the >function exit: macro does not execute (I mean the new run of macro) after >the first usage of exit. I have to quit root and only then the macro >executes again: > >errorHandling.C: > >// Test macro for error handling > >#include <stdlib.h> > >Int_t errorHandling(Int_t error=0) >{ > cerr<<"Error is "<<error<<endl; > if (error) { >// error occurred, exit macro > cerr<<"Error in errorHandling macro: "<<error<<endl; > exit (EXIT_FAILURE); > } > cerr<<"No error in the macro"<<endl; > return 0; >} > > >[pcepaip16] ~/macros > root.exe > ******************************************* > * * > * W E L C O M E to R O O T * > * * > * Version 3.00/05 6 March 2001 * > * * > * You are welcome to visit our Web site * > * http://root.cern.ch * > * * > ******************************************* > >FreeType Engine v1.x used to render TrueType fonts. > >CINT/ROOT C/C++ Interpreter version 5.14.78, Feb 21 2001 >Type ? for help. Commands must be C++ statements. >Enclose multiple statements between { }. >root [0] .x errorHandling.C(0) >Error is 0 >No error in the macro >(Int_t)0 >root [1] .x errorHandling.C(0) >Error is 0 >No error in the macro >(Int_t)0 >root [2] .x errorHandling.C(1) >Error is 1 >Error in error_handling macro: 1 >(Int_t)1 >root [3] .x errorHandling.C(1) >root [4] > >-> no output after the command [3].
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:38 MET