Created
October 26, 2013 17:56
-
-
Save iamjono/7172546 to your computer and use it in GitHub Desktop.
"shellhandler" trait for Lasso 9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
/* ========================================================== | |
shellhandler trait | |
Usage once imported into Lasso 9 type: | |
.shellhandler('ls') -> directory list | |
trait { | |
import std_shellhandler | |
} | |
========================================================== */ | |
define std_shellhandler => trait { | |
provide shellhandler(cmd::string) => { | |
local(shell = sys_process('/bin/bash', (: '-c', #cmd))) | |
handle => { #shell->close } | |
#shell->wait | |
#shell->readError->size ? return #shell->readError | return #shell->read | |
} | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage once imported into Lasso 9 type:
.shellhandler('ls') -> directory list
To import into a Lasso 9 Type