Skip to content

Instantly share code, notes, and snippets.

@iamjono
Created October 26, 2013 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamjono/7172546 to your computer and use it in GitHub Desktop.
Save iamjono/7172546 to your computer and use it in GitHub Desktop.
"shellhandler" trait for Lasso 9
[
/* ==========================================================
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
}
}
]
@iamjono
Copy link
Author

iamjono commented Oct 26, 2013

Usage once imported into Lasso 9 type:

.shellhandler('ls') -> directory list

To import into a Lasso 9 Type

trait { 
  import std_shellhandler
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment