<s> import plat <EOL> import plat . linux <EOL> import plat . osx <EOL> import plat . windows <EOL> def run_and_wait ( view , cmd ) : <EOL> if plat . HOST_PLATFORM == plat . WINDOWS : <EOL> plat . windows . run_and_wait ( view , cmd ) <EOL> elif plat . HOST_PLATFORM == plat . LINUX : <EOL> plat . linux . run_and_wait ( view , cmd ) <EOL> elif plat . HOST_PLATFORM == plat . OSX : <EOL> plat . osx . run_and_wait ( view , cmd ) <EOL> else : <EOL> raise NotImplementedError <EOL> def filter_thru_shell ( view , regions , cmd ) : <EOL> try : <EOL> edit = view . begin_edit ( ) <EOL> if plat . HOST_PLATFORM == plat . WINDOWS : <EOL> filter_func = plat . windows . filter_region <EOL> elif plat . HOST_PLATFORM == plat . LINUX : <EOL> filter_func = plat . linux . filter_region <EOL> elif plat . HOST_PLATFORM == plat . OSX : <EOL> filter_func = plat . osx . filter_region <EOL> else : <EOL> raise NotImplementedError <EOL> for r in reversed ( regions ) : <EOL> rv = filter_func ( view , view . substr ( r ) , cmd ) <EOL> view . replace ( edit , r , rv ) <EOL> finally : <EOL> view . end_edit ( edit ) </s>
