Skip to content

Instantly share code, notes, and snippets.

@wbbradley
Last active December 30, 2017 04:26
Show Gist options
  • Save wbbradley/76e646c85be39abdb6d95a63f16af78b to your computer and use it in GitHub Desktop.
Save wbbradley/76e646c85be39abdb6d95a63f16af78b to your computer and use it in GitHub Desktop.
start of simple tee implementation
module tee
get sys
get file
def main()
if len(sys.args) == 2
newline := "\n"
f := file.open(sys.args[1], "w")
state := f.state
when state
is file.Open
for line in readlines()
print(line)
file.write(f, line)
file.write(f, newline)
file.close(f)
is file.Error
print("Failed to open file " + sys.args[1] + ": error " + state.errno)
sys.exit(-1)
is file.Closed
print("Failed to open file " + sys.args[1])
sys.exit(-1)
else
for line in readlines()
print(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment