Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- proc runTemplate*(cTemplate: CustomTemplate): Future[string] =
- var retFuture = newFuture[string]("runTemplate")
- try:
- let path = cTemplate.path
- let fileName = cTemplate.fileName
- let command = cTemplate.command
- let splittedPath = splitFile(path)
- let runnableFilePath = joinPath(splittedPath.dir, fileName)
- let generatedTemplate = cTemplate.generateTemplate()
- let tempFile = createTemporaryFile(runnableFilePath, generatedTemplate)
- let execResult = execProcess(fmt"{command} {tempFile}").string
- retFuture.complete(execResult)
- return retFuture
- except:
- return retFuture
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement