Changeset 813

Show
Ignore:
Timestamp:
09/20/07 17:44:36 (1 year ago)
Author:
Gregor
Message:

hcf/process.d, sss/conf.d: Now throws an exception if a hook command fails, rather than

exiting. This allows DSSS to clean up after itself more effectively.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/docs/ChangeLog

    r807 r813  
    99        - installdir hook command now manifests properly. 
    1010        - 'include' setting, counter to 'exclude' (see ticket #111). 
     11        - Now throws an exception if a hook command fails, rather than 
     12          exiting. This allows DSSS to clean up after itself more effectively. 
    1113 
    12140.72 from 0.71: 
  • trunk/hcf/process.d

    r642 r813  
    256256} 
    257257 
     258/** Exception to be thrown when a command called dies */ 
     259class ProcessDeathException : Exception { 
     260    this(char[] smsg) 
     261    { 
     262        super(smsg); 
     263    } 
     264} 
     265 
    258266/** system + guarantee success */ 
    259267void systemOrDie(char[] cmd) 
     
    267275        if(p!=-1) cmd=cmd[0..p]; 
    268276        writefln("Command " ~ cmd ~ " returned with code ", res, ", aborting."); 
    269         exit(1); 
     277        throw new ProcessDeathException("Command failed, aborting."); 
    270278    } 
    271279} 
     
    314322        if(p!=-1) cmd=cmd[0..p]; 
    315323        writefln("Command " ~ cmd ~ " returned with code ", res, ", aborting."); 
    316         exit(1); 
     324        throw new ProcessDeathException("Command failed, aborting."); 
    317325    } 
    318326} 
  • trunk/sss/conf.d

    r807 r813  
    847847} 
    848848 
     849/** Exception to be thrown when a scripted step fails */ 
     850class HookException : Exception { 
     851    this(char[] smsg) 
     852    { 
     853        super(smsg); 
     854    } 
     855} 
     856 
    849857/** Perform a pre- or post- script step. Returns a list of installed files (if 
    850858 * applicable) */ 
     
    879887                   cmd[0..6] == "error ") { 
    880888            writefln("ERROR: %s", cmd[6..$]); 
    881             exit(1); 
     889            throw new HookException("error hook encountered."); 
    882890             
    883891        } else if (cmd.length > 8 &&