aboutsummaryrefslogtreecommitdiff
path: root/examples/commands/commands.tm
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-17 21:22:10 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-03-17 21:22:10 -0400
commit80ca0f0b1ba04c1aa3d7bb1a62928dbcecbb3bd8 (patch)
tree0306535e85bf1e06ca27ee72fee4b955ae8784dd /examples/commands/commands.tm
parent3873e806b0b91c21f98ec1232852d35b8a2d6dde (diff)
Command.from_path()
Diffstat (limited to 'examples/commands/commands.tm')
-rw-r--r--examples/commands/commands.tm3
1 files changed, 3 insertions, 0 deletions
diff --git a/examples/commands/commands.tm b/examples/commands/commands.tm
index 940dc3d9..a0e73908 100644
--- a/examples/commands/commands.tm
+++ b/examples/commands/commands.tm
@@ -32,6 +32,9 @@ struct ProgramResult(stdout:[Byte], stderr:[Byte], exit_type:ExitType):
return none
struct Command(command:Text, args=[:Text], env={:Text,Text}):
+ func from_path(path:Path, args=[:Text], env={:Text,Text} -> Command):
+ return Command(Text(path), args, env)
+
func run(command:Command, input="", input_bytes=[:Byte] -> ProgramResult):
if input.length > 0:
(&input_bytes):insert_all(input:bytes())