<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">These kinds of things live in Foundation, not the standard library:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Courier" class="">import Foundation</font><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">let p = Process()</font></div><div class=""><font face="Courier" class="">p.executableURL = URL(fileURLWithPath: "/bin/ps")</font></div><div class=""><font face="Courier" class="">try p.run()</font></div></blockquote><div class=""><br class=""></div><div class="">The Process class provides you with stdin/out/error handles for the process (<a href="https://developer.apple.com/documentation/foundation/process" class="">https://developer.apple.com/documentation/foundation/process</a>).</div><div class="">FileHandle also provides these standard streams for the current process (<a href="https://developer.apple.com/documentation/foundation/filehandle" class="">https://developer.apple.com/documentation/foundation/filehandle</a>).</div><div class=""><br class=""></div><div class="">- Karl<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 4. Jan 2018, at 17:03, Седых Александр via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
<div class=""><p style="margin-bottom: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: 'Helvetica Neue'; color: #454545;" data-mce-style="margin-bottom: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: 'Helvetica Neue'; color: #454545;" class="">Well, for example in Python we can run another program from interpreter by</p><div style="margin-bottom: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69); min-height: 14px;" class=""> <br class="webkit-block-placeholder"></div><p style="margin-bottom: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: 'Helvetica Neue'; color: #454545;" data-mce-style="margin-bottom: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: 'Helvetica Neue'; color: #454545;" class="">import subprocess</p><p style="margin-bottom: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: 'Helvetica Neue'; color: #454545;" data-mce-style="margin-bottom: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: 'Helvetica Neue'; color: #454545;" class="">result = subprocess.run('ruby script.rb').stdout</p><div style="margin-bottom: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69); min-height: 14px;" class=""> <br class="webkit-block-placeholder"></div><p style="margin-bottom: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: 'Helvetica Neue'; color: #454545;" data-mce-style="margin-bottom: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: 'Helvetica Neue'; color: #454545;" class="">My question is next:</p><p style="margin-bottom: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: 'Helvetica Neue'; color: #454545;" data-mce-style="margin-bottom: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: 'Helvetica Neue'; color: #454545;" class="">Can we do something from Swift file at runtime or maybe from terminal via REPL</p><div style="margin-bottom: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69); min-height: 14px;" class=""> <br class="webkit-block-placeholder"></div><p style="margin-bottom: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: 'Helvetica Neue'; color: #454545;" data-mce-style="margin-bottom: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: 'Helvetica Neue'; color: #454545;" class="">And can you send me resource when I can read about work with stdin, stdout in Swift, because is very small info in Documentation (Standard Library I/O)</p><br class="">-<br class="">Alexandr</div>
_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-users<br class=""></div></blockquote></div><br class=""></div></body></html>