File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 1717import logging
1818from typing import Text
1919
20+ from launch .frontend import Entity
21+ from launch .frontend import expose_action
22+ from launch .frontend import Parser
23+
2024from .emit_event import EmitEvent
2125from ..events import Shutdown as ShutdownEvent
2226from ..events .process import ProcessExited
2529_logger = logging .getLogger (name = 'launch' )
2630
2731
32+ @expose_action ('shutdown' )
2833class Shutdown (EmitEvent ):
2934 """Action that shuts down a launched system by emitting Shutdown when executed."""
3035
3136 def __init__ (self , * , reason : Text = 'reason not given' , ** kwargs ):
3237 super ().__init__ (event = ShutdownEvent (reason = reason ), ** kwargs )
3338
39+ @classmethod
40+ def parse (cls , entity : Entity , parser : Parser ):
41+ """Return `Shutdown` action and kwargs for constructing it."""
42+ _ , kwargs = super ().parse (entity , parser )
43+ reason = entity .get_attr ('reason' , optional = True )
44+ if reason :
45+ kwargs ['reason' ] = parser .parse_substitution (reason )
46+ return cls , kwargs
47+
3448 def execute (self , context : LaunchContext ):
3549 """Execute the action."""
3650 try :
You can’t perform that action at this time.
0 commit comments