1<!DOCTYPE html> 2<html lang="en"> 3<head> 4<meta charset="UTF-8"> 5<title>sampleFile - OpenGrok cross reference for /sampleFile</title></head><body> 6<script type="text/javascript">/* <![CDATA[ */ 7function get_sym_list(){return [["Package","xp",[["fzf",23]]],["Struct","xs",[["Reader",36]]]];} /* ]]> */</script><a class="l" name="1" href="#1">1</a><span class="c">// The MIT License (MIT)</span> 8<a class="l" name="2" href="#2">2</a><span class="c">//</span> 9<a class="l" name="3" href="#3">3</a><span class="c">// Copyright (c) 2016 Junegunn Choi</span> 10<a class="l" name="4" href="#4">4</a><span class="c">//</span> 11<a class="l" name="5" href="#5">5</a><span class="c">// Permission is hereby granted, free of charge, to any person obtaining a copy</span> 12<a class="l" name="6" href="#6">6</a><span class="c">// of this software and associated documentation files (the "Software"), to deal</span> 13<a class="l" name="7" href="#7">7</a><span class="c">// in the Software without restriction, including without limitation the rights</span> 14<a class="l" name="8" href="#8">8</a><span class="c">// to use, copy, modify, merge, publish, distribute, sublicense, <a href="/source/s?path=and/">and</a>/<a href="/source/s?path=and/or">or</a> sell</span> 15<a class="l" name="9" href="#9">9</a><span class="c">// copies of the Software, and to permit persons to whom the Software is</span> 16<a class="hl" name="10" href="#10">10</a><span class="c">// furnished to do so, subject to the following conditions:</span> 17<a class="l" name="11" href="#11">11</a><span class="c">//</span> 18<a class="l" name="12" href="#12">12</a><span class="c">// The above copyright notice and this permission notice shall be included in</span> 19<a class="l" name="13" href="#13">13</a><span class="c">// all copies or substantial portions of the Software.</span> 20<a class="l" name="14" href="#14">14</a><span class="c">//</span> 21<a class="l" name="15" href="#15">15</a><span class="c">// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span> 22<a class="l" name="16" href="#16">16</a><span class="c">// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span> 23<a class="l" name="17" href="#17">17</a><span class="c">// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE</span> 24<a class="l" name="18" href="#18">18</a><span class="c">// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span> 25<a class="l" name="19" href="#19">19</a><span class="c">// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,</span> 26<a class="hl" name="20" href="#20">20</a><span class="c">// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN</span> 27<a class="l" name="21" href="#21">21</a><span class="c">// THE SOFTWARE.</span> 28<a class="l" name="22" href="#22">22</a> 29<a class="l" name="23" href="#23">23</a><b>package</b> <a class="xp" name="fzf"/><a href="/source/s?refs=fzf" class="xp intelliWindow-symbol" data-definition-place="def">fzf</a> 30<a class="l" name="24" href="#24">24</a> 31<a class="l" name="25" href="#25">25</a><b>import</b> ( 32<a class="l" name="26" href="#26">26</a> <span class="s">"bufio"</span> 33<a class="l" name="27" href="#27">27</a> <span class="s">"io"</span> 34<a class="l" name="28" href="#28">28</a> <span class="s">"os"</span> 35<a class="l" name="29" href="#29">29</a> <span class="s">"<a href="/source/s?path=sync/">sync</a>/<a href="/source/s?path=sync/atomic">atomic</a>"</span> 36<a class="hl" name="30" href="#30">30</a> <span class="s">"time"</span> 37<a class="l" name="31" href="#31">31</a> 38<a class="l" name="32" href="#32">32</a> <span class="s">"<a href="/source/s?path=github.com/">github.com</a>/<a href="/source/s?path=github.com/junegunn/">junegunn</a>/<a href="/source/s?path=github.com/junegunn/fzf/">fzf</a>/<a href="/source/s?path=github.com/junegunn/fzf/src/">src</a>/<a href="/source/s?path=github.com/junegunn/fzf/src/util">util</a>"</span> 39<a class="l" name="33" href="#33">33</a>) 40<a class="l" name="34" href="#34">34</a> 41<a class="l" name="35" href="#35">35</a><span class="c">// Reader reads from command or standard input</span> 42<a class="l" name="36" href="#36">36</a><b>type</b> <a class="xs" name="Reader"/><a href="/source/s?refs=Reader" class="xs intelliWindow-symbol" data-definition-place="def">Reader</a> <b>struct</b> { 43<a class="l" name="37" href="#37">37</a> <a class="xmb" name="pusher"/><a href="/source/s?refs=pusher" class="xmb intelliWindow-symbol" data-definition-place="def">pusher</a> <b>func</b>([]<b>byte</b>) <b>bool</b> 44<a class="l" name="38" href="#38">38</a> <a class="xmb" name="eventBox"/><a href="/source/s?refs=eventBox" class="xmb intelliWindow-symbol" data-definition-place="def">eventBox</a> *<a href="/source/s?defs=util" class="intelliWindow-symbol" data-definition-place="undefined-in-file">util</a>.<a class="d intelliWindow-symbol" href="#EventBox" data-definition-place="defined-in-file">EventBox</a> 45<a class="l" name="39" href="#39">39</a> <a class="xmb" name="delimNil"/><a href="/source/s?refs=delimNil" class="xmb intelliWindow-symbol" data-definition-place="def">delimNil</a> <b>bool</b> 46<a class="hl" name="40" href="#40">40</a> <a class="xmb" name="event"/><a href="/source/s?refs=event" class="xmb intelliWindow-symbol" data-definition-place="def">event</a> <b>int32</b> 47<a class="l" name="41" href="#41">41</a>} 48<a class="l" name="42" href="#42">42</a> 49<a class="l" name="43" href="#43">43</a><span class="c">// NewReader returns new Reader object</span> 50<a class="l" name="44" href="#44">44</a><b>func</b> <a class="d" name="NewReader"/><a href="/source/s?refs=NewReader" class="d intelliWindow-symbol" data-definition-place="def">NewReader</a>(<a class="d intelliWindow-symbol" href="#pusher" data-definition-place="defined-in-file">pusher</a> <b>func</b>([]<b>byte</b>) <b>bool</b>, <a class="d intelliWindow-symbol" href="#eventBox" data-definition-place="defined-in-file">eventBox</a> *<a href="/source/s?defs=util" class="intelliWindow-symbol" data-definition-place="undefined-in-file">util</a>.<a class="xa" name="EventBox"/><a href="/source/s?refs=EventBox" class="xa intelliWindow-symbol" data-definition-place="def">EventBox</a>, <a class="d intelliWindow-symbol" href="#delimNil" data-definition-place="defined-in-file">delimNil</a> <b>bool</b>) *<a href="/source/s?defs=Reader" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Reader</a> { 51<a class="l" name="45" href="#45">45</a> <b>return</b> &<a href="/source/s?defs=Reader" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Reader</a>{<a class="d intelliWindow-symbol" href="#pusher" data-definition-place="defined-in-file">pusher</a>, <a class="d intelliWindow-symbol" href="#eventBox" data-definition-place="defined-in-file">eventBox</a>, <a class="d intelliWindow-symbol" href="#delimNil" data-definition-place="defined-in-file">delimNil</a>, <b>int32</b>(<a href="/source/s?defs=EvtReady" class="intelliWindow-symbol" data-definition-place="undefined-in-file">EvtReady</a>)} 52<a class="l" name="46" href="#46">46</a>} 53<a class="l" name="47" href="#47">47</a> 54<a class="l" name="48" href="#48">48</a><b>func</b> (<a href="/source/s?defs=r" class="intelliWindow-symbol" data-definition-place="undefined-in-file">r</a> *<a href="/source/s?defs=Reader" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Reader</a>) <a class="d" name="startEventPoller"/><a href="/source/s?refs=startEventPoller" class="d intelliWindow-symbol" data-definition-place="def">startEventPoller</a>() { 55<a class="l" name="49" href="#49">49</a> <b>go</b> <b>func</b>() { 56<a class="hl" name="50" href="#50">50</a> <a href="/source/s?defs=ptr" class="intelliWindow-symbol" data-definition-place="undefined-in-file">ptr</a> := &<a href="/source/s?defs=r" class="intelliWindow-symbol" data-definition-place="undefined-in-file">r</a>.<a class="d intelliWindow-symbol" href="#event" data-definition-place="defined-in-file">event</a> 57<a class="l" name="51" href="#51">51</a> <a href="/source/s?defs=pollInterval" class="intelliWindow-symbol" data-definition-place="undefined-in-file">pollInterval</a> := <a href="/source/s?defs=readerPollIntervalMin" class="intelliWindow-symbol" data-definition-place="undefined-in-file">readerPollIntervalMin</a> 58<a class="l" name="52" href="#52">52</a> <b>for</b> { 59<a class="l" name="53" href="#53">53</a> <b>if</b> <a href="/source/s?defs=atomic" class="intelliWindow-symbol" data-definition-place="undefined-in-file">atomic</a>.<a href="/source/s?defs=CompareAndSwapInt32" class="intelliWindow-symbol" data-definition-place="undefined-in-file">CompareAndSwapInt32</a>(<a href="/source/s?defs=ptr" class="intelliWindow-symbol" data-definition-place="undefined-in-file">ptr</a>, <b>int32</b>(<a href="/source/s?defs=EvtReadNew" class="intelliWindow-symbol" data-definition-place="undefined-in-file">EvtReadNew</a>), <b>int32</b>(<a href="/source/s?defs=EvtReady" class="intelliWindow-symbol" data-definition-place="undefined-in-file">EvtReady</a>)) { 60<a class="l" name="54" href="#54">54</a> <a href="/source/s?defs=r" class="intelliWindow-symbol" data-definition-place="undefined-in-file">r</a>.<a class="d intelliWindow-symbol" href="#eventBox" data-definition-place="defined-in-file">eventBox</a>.<a href="/source/s?defs=Set" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Set</a>(<a href="/source/s?defs=EvtReadNew" class="intelliWindow-symbol" data-definition-place="undefined-in-file">EvtReadNew</a>, <b>true</b>) 61<a class="l" name="55" href="#55">55</a> <a href="/source/s?defs=pollInterval" class="intelliWindow-symbol" data-definition-place="undefined-in-file">pollInterval</a> = <a href="/source/s?defs=readerPollIntervalMin" class="intelliWindow-symbol" data-definition-place="undefined-in-file">readerPollIntervalMin</a> 62<a class="l" name="56" href="#56">56</a> } <b>else</b> <b>if</b> <a href="/source/s?defs=atomic" class="intelliWindow-symbol" data-definition-place="undefined-in-file">atomic</a>.<a href="/source/s?defs=LoadInt32" class="intelliWindow-symbol" data-definition-place="undefined-in-file">LoadInt32</a>(<a href="/source/s?defs=ptr" class="intelliWindow-symbol" data-definition-place="undefined-in-file">ptr</a>) == <b>int32</b>(<a href="/source/s?defs=EvtReadFin" class="intelliWindow-symbol" data-definition-place="undefined-in-file">EvtReadFin</a>) { 63<a class="l" name="57" href="#57">57</a> <b>return</b> 64<a class="l" name="58" href="#58">58</a> } <b>else</b> { 65<a class="l" name="59" href="#59">59</a> <a href="/source/s?defs=pollInterval" class="intelliWindow-symbol" data-definition-place="undefined-in-file">pollInterval</a> += <a href="/source/s?defs=readerPollIntervalStep" class="intelliWindow-symbol" data-definition-place="undefined-in-file">readerPollIntervalStep</a> 66<a class="hl" name="60" href="#60">60</a> <b>if</b> <a href="/source/s?defs=pollInterval" class="intelliWindow-symbol" data-definition-place="undefined-in-file">pollInterval</a> > <a href="/source/s?defs=readerPollIntervalMax" class="intelliWindow-symbol" data-definition-place="undefined-in-file">readerPollIntervalMax</a> { 67<a class="l" name="61" href="#61">61</a> <a href="/source/s?defs=pollInterval" class="intelliWindow-symbol" data-definition-place="undefined-in-file">pollInterval</a> = <a href="/source/s?defs=readerPollIntervalMax" class="intelliWindow-symbol" data-definition-place="undefined-in-file">readerPollIntervalMax</a> 68<a class="l" name="62" href="#62">62</a> } 69<a class="l" name="63" href="#63">63</a> } 70<a class="l" name="64" href="#64">64</a> <a href="/source/s?defs=time" class="intelliWindow-symbol" data-definition-place="undefined-in-file">time</a>.<a href="/source/s?defs=Sleep" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Sleep</a>(<a href="/source/s?defs=pollInterval" class="intelliWindow-symbol" data-definition-place="undefined-in-file">pollInterval</a>) 71<a class="l" name="65" href="#65">65</a> } 72<a class="l" name="66" href="#66">66</a> }() 73<a class="l" name="67" href="#67">67</a>} 74<a class="l" name="68" href="#68">68</a> 75<a class="l" name="69" href="#69">69</a><b>func</b> (<a href="/source/s?defs=r" class="intelliWindow-symbol" data-definition-place="undefined-in-file">r</a> *<a href="/source/s?defs=Reader" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Reader</a>) <a class="d" name="fin"/><a href="/source/s?refs=fin" class="d intelliWindow-symbol" data-definition-place="def">fin</a>(<a href="/source/s?defs=success" class="intelliWindow-symbol" data-definition-place="undefined-in-file">success</a> <b>bool</b>) { 76<a class="hl" name="70" href="#70">70</a> <a href="/source/s?defs=atomic" class="intelliWindow-symbol" data-definition-place="undefined-in-file">atomic</a>.<a href="/source/s?defs=StoreInt32" class="intelliWindow-symbol" data-definition-place="undefined-in-file">StoreInt32</a>(&<a href="/source/s?defs=r" class="intelliWindow-symbol" data-definition-place="undefined-in-file">r</a>.<a class="d intelliWindow-symbol" href="#event" data-definition-place="defined-in-file">event</a>, <b>int32</b>(<a href="/source/s?defs=EvtReadFin" class="intelliWindow-symbol" data-definition-place="undefined-in-file">EvtReadFin</a>)) 77<a class="l" name="71" href="#71">71</a> <a href="/source/s?defs=r" class="intelliWindow-symbol" data-definition-place="undefined-in-file">r</a>.<a class="d intelliWindow-symbol" href="#eventBox" data-definition-place="defined-in-file">eventBox</a>.<a href="/source/s?defs=Set" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Set</a>(<a href="/source/s?defs=EvtReadFin" class="intelliWindow-symbol" data-definition-place="undefined-in-file">EvtReadFin</a>, <a href="/source/s?defs=success" class="intelliWindow-symbol" data-definition-place="undefined-in-file">success</a>) 78<a class="l" name="72" href="#72">72</a>} 79<a class="l" name="73" href="#73">73</a> 80<a class="l" name="74" href="#74">74</a><span class="c">// ReadSource reads data from the default command or from standard input</span> 81<a class="l" name="75" href="#75">75</a><b>func</b> (<a href="/source/s?defs=r" class="intelliWindow-symbol" data-definition-place="undefined-in-file">r</a> *<a href="/source/s?defs=Reader" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Reader</a>) <a class="d" name="ReadSource"/><a href="/source/s?refs=ReadSource" class="d intelliWindow-symbol" data-definition-place="def">ReadSource</a>() { 82<a class="l" name="76" href="#76">76</a> <a href="/source/s?defs=r" class="intelliWindow-symbol" data-definition-place="undefined-in-file">r</a>.<a class="d intelliWindow-symbol" href="#startEventPoller" data-definition-place="defined-in-file">startEventPoller</a>() 83<a class="l" name="77" href="#77">77</a> <b>var</b> <a href="/source/s?defs=success" class="intelliWindow-symbol" data-definition-place="undefined-in-file">success</a> <b>bool</b> 84<a class="l" name="78" href="#78">78</a> <b>if</b> <a href="/source/s?defs=util" class="intelliWindow-symbol" data-definition-place="undefined-in-file">util</a>.<a href="/source/s?defs=IsTty" class="intelliWindow-symbol" data-definition-place="undefined-in-file">IsTty</a>() { 85<a class="l" name="79" href="#79">79</a> <a href="/source/s?defs=cmd" class="intelliWindow-symbol" data-definition-place="undefined-in-file">cmd</a> := <a href="/source/s?defs=os" class="intelliWindow-symbol" data-definition-place="undefined-in-file">os</a>.<a href="/source/s?defs=Getenv" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Getenv</a>(<span class="s">"FZF_DEFAULT_COMMAND"</span>) 86<a class="hl" name="80" href="#80">80</a> <b>if</b> <b>len</b>(<a href="/source/s?defs=cmd" class="intelliWindow-symbol" data-definition-place="undefined-in-file">cmd</a>) == <span class="n">0</span> { 87<a class="l" name="81" href="#81">81</a> <span class="c">// The default command for *nix requires bash</span> 88<a class="l" name="82" href="#82">82</a> <a href="/source/s?defs=success" class="intelliWindow-symbol" data-definition-place="undefined-in-file">success</a> = <a href="/source/s?defs=r" class="intelliWindow-symbol" data-definition-place="undefined-in-file">r</a>.<a class="d intelliWindow-symbol" href="#readFromCommand" data-definition-place="defined-in-file">readFromCommand</a>(<span class="s">"bash"</span>, <a href="/source/s?defs=defaultCommand" class="intelliWindow-symbol" data-definition-place="undefined-in-file">defaultCommand</a>) 89<a class="l" name="83" href="#83">83</a> } <b>else</b> { 90<a class="l" name="84" href="#84">84</a> <a href="/source/s?defs=success" class="intelliWindow-symbol" data-definition-place="undefined-in-file">success</a> = <a href="/source/s?defs=r" class="intelliWindow-symbol" data-definition-place="undefined-in-file">r</a>.<a class="d intelliWindow-symbol" href="#readFromCommand" data-definition-place="defined-in-file">readFromCommand</a>(<span class="s">"sh"</span>, <a href="/source/s?defs=cmd" class="intelliWindow-symbol" data-definition-place="undefined-in-file">cmd</a>) 91<a class="l" name="85" href="#85">85</a> } 92<a class="l" name="86" href="#86">86</a> } <b>else</b> { 93<a class="l" name="87" href="#87">87</a> <a href="/source/s?defs=success" class="intelliWindow-symbol" data-definition-place="undefined-in-file">success</a> = <a href="/source/s?defs=r" class="intelliWindow-symbol" data-definition-place="undefined-in-file">r</a>.<a class="d intelliWindow-symbol" href="#readFromStdin" data-definition-place="defined-in-file">readFromStdin</a>() 94<a class="l" name="88" href="#88">88</a> } 95<a class="l" name="89" href="#89">89</a> <a href="/source/s?defs=r" class="intelliWindow-symbol" data-definition-place="undefined-in-file">r</a>.<a class="d intelliWindow-symbol" href="#fin" data-definition-place="defined-in-file">fin</a>(<a href="/source/s?defs=success" class="intelliWindow-symbol" data-definition-place="undefined-in-file">success</a>) 96<a class="hl" name="90" href="#90">90</a>} 97<a class="l" name="91" href="#91">91</a> 98<a class="l" name="92" href="#92">92</a><b>func</b> (<a href="/source/s?defs=r" class="intelliWindow-symbol" data-definition-place="undefined-in-file">r</a> *<a class="xa" name="Reader"/><a href="/source/s?refs=Reader" class="xa intelliWindow-symbol" data-definition-place="def">Reader</a>) <a class="d" name="feed"/><a href="/source/s?refs=feed" class="d intelliWindow-symbol" data-definition-place="def">feed</a>(<a href="/source/s?defs=src" class="intelliWindow-symbol" data-definition-place="undefined-in-file">src</a> <a href="/source/s?defs=io" class="intelliWindow-symbol" data-definition-place="undefined-in-file">io</a>.<a href="/source/s?defs=Reader" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Reader</a>) { 99<a class="l" name="93" href="#93">93</a> <a href="/source/s?defs=delim" class="intelliWindow-symbol" data-definition-place="undefined-in-file">delim</a> := <b>byte</b>(<span class="s">'\n'</span>) 100<a class="l" name="94" href="#94">94</a> <b>if</b> <a href="/source/s?defs=r" class="intelliWindow-symbol" data-definition-place="undefined-in-file">r</a>.<a class="d intelliWindow-symbol" href="#delimNil" data-definition-place="defined-in-file">delimNil</a> { 101<a class="l" name="95" href="#95">95</a> <a href="/source/s?defs=delim" class="intelliWindow-symbol" data-definition-place="undefined-in-file">delim</a> = <span class="s">'\000'</span> 102<a class="l" name="96" href="#96">96</a> } 103<a class="l" name="97" href="#97">97</a> <a href="/source/s?defs=reader" class="intelliWindow-symbol" data-definition-place="undefined-in-file">reader</a> := <a href="/source/s?defs=bufio" class="intelliWindow-symbol" data-definition-place="undefined-in-file">bufio</a>.<a href="/source/s?defs=NewReaderSize" class="intelliWindow-symbol" data-definition-place="undefined-in-file">NewReaderSize</a>(<a href="/source/s?defs=src" class="intelliWindow-symbol" data-definition-place="undefined-in-file">src</a>, <a href="/source/s?defs=readerBufferSize" class="intelliWindow-symbol" data-definition-place="undefined-in-file">readerBufferSize</a>) 104<a class="l" name="98" href="#98">98</a> <b>for</b> { 105<a class="l" name="99" href="#99">99</a> <span class="c">// ReadBytes returns err != nil if and only if the returned data does not</span> 106<a class="hl" name="100" href="#100">100</a> <span class="c">// end in delim.</span> 107<a class="l" name="101" href="#101">101</a> <a href="/source/s?defs=bytea" class="intelliWindow-symbol" data-definition-place="undefined-in-file">bytea</a>, <a href="/source/s?defs=err" class="intelliWindow-symbol" data-definition-place="undefined-in-file">err</a> := <a href="/source/s?defs=reader" class="intelliWindow-symbol" data-definition-place="undefined-in-file">reader</a>.<a href="/source/s?defs=ReadBytes" class="intelliWindow-symbol" data-definition-place="undefined-in-file">ReadBytes</a>(<a href="/source/s?defs=delim" class="intelliWindow-symbol" data-definition-place="undefined-in-file">delim</a>) 108<a class="l" name="102" href="#102">102</a> <a href="/source/s?defs=byteaLen" class="intelliWindow-symbol" data-definition-place="undefined-in-file">byteaLen</a> := <b>len</b>(<a href="/source/s?defs=bytea" class="intelliWindow-symbol" data-definition-place="undefined-in-file">bytea</a>) 109<a class="l" name="103" href="#103">103</a> <b>if</b> <a href="/source/s?defs=byteaLen" class="intelliWindow-symbol" data-definition-place="undefined-in-file">byteaLen</a> > <span class="n">0</span> || <a href="/source/s?defs=byteaLen" class="intelliWindow-symbol" data-definition-place="undefined-in-file">byteaLen</a> > <span class="n">0xFF</span> { 110<a class="l" name="104" href="#104">104</a> <b>if</b> <a href="/source/s?defs=err" class="intelliWindow-symbol" data-definition-place="undefined-in-file">err</a> == <b>nil</b> { 111<a class="l" name="105" href="#105">105</a> <span class="c">// get rid of carriage return if under Windows:</span> 112<a class="l" name="106" href="#106">106</a> <b>if</b> <a href="/source/s?defs=util" class="intelliWindow-symbol" data-definition-place="undefined-in-file">util</a>.<a href="/source/s?defs=IsWindows" class="intelliWindow-symbol" data-definition-place="undefined-in-file">IsWindows</a>() && <a href="/source/s?defs=byteaLen" class="intelliWindow-symbol" data-definition-place="undefined-in-file">byteaLen</a> >= <span class="n">2</span> && <a href="/source/s?defs=bytea" class="intelliWindow-symbol" data-definition-place="undefined-in-file">bytea</a>[<a href="/source/s?defs=byteaLen" class="intelliWindow-symbol" data-definition-place="undefined-in-file">byteaLen</a>-<span class="n">2</span>] == <b>byte</b>(<span class="s">'\r'</span>) { 113<a class="l" name="107" href="#107">107</a> <a href="/source/s?defs=bytea" class="intelliWindow-symbol" data-definition-place="undefined-in-file">bytea</a> = <a href="/source/s?defs=bytea" class="intelliWindow-symbol" data-definition-place="undefined-in-file">bytea</a>[:<a href="/source/s?defs=byteaLen" class="intelliWindow-symbol" data-definition-place="undefined-in-file">byteaLen</a>-<span class="n">2</span>] 114<a class="l" name="108" href="#108">108</a> } <b>else</b> { 115<a class="l" name="109" href="#109">109</a> <a href="/source/s?defs=bytea" class="intelliWindow-symbol" data-definition-place="undefined-in-file">bytea</a> = <a href="/source/s?defs=bytea" class="intelliWindow-symbol" data-definition-place="undefined-in-file">bytea</a>[:<a href="/source/s?defs=byteaLen" class="intelliWindow-symbol" data-definition-place="undefined-in-file">byteaLen</a>-<span class="n">1</span>] 116<a class="hl" name="110" href="#110">110</a> } 117<a class="l" name="111" href="#111">111</a> } 118<a class="l" name="112" href="#112">112</a> <b>if</b> <a href="/source/s?defs=r" class="intelliWindow-symbol" data-definition-place="undefined-in-file">r</a>.<a class="d intelliWindow-symbol" href="#pusher" data-definition-place="defined-in-file">pusher</a>(<a href="/source/s?defs=bytea" class="intelliWindow-symbol" data-definition-place="undefined-in-file">bytea</a>) { 119<a class="l" name="113" href="#113">113</a> <a href="/source/s?defs=atomic" class="intelliWindow-symbol" data-definition-place="undefined-in-file">atomic</a>.<a href="/source/s?defs=StoreInt32" class="intelliWindow-symbol" data-definition-place="undefined-in-file">StoreInt32</a>(&<a href="/source/s?defs=r" class="intelliWindow-symbol" data-definition-place="undefined-in-file">r</a>.<a class="d intelliWindow-symbol" href="#event" data-definition-place="defined-in-file">event</a>, <b>int32</b>(<a href="/source/s?defs=EvtReadNew" class="intelliWindow-symbol" data-definition-place="undefined-in-file">EvtReadNew</a>)) 120<a class="l" name="114" href="#114">114</a> } 121<a class="l" name="115" href="#115">115</a> } 122<a class="l" name="116" href="#116">116</a> <b>if</b> <a href="/source/s?defs=err" class="intelliWindow-symbol" data-definition-place="undefined-in-file">err</a> != <b>nil</b> { 123<a class="l" name="117" href="#117">117</a> <b>break</b> 124<a class="l" name="118" href="#118">118</a> } 125<a class="l" name="119" href="#119">119</a> } 126<a class="hl" name="120" href="#120">120</a>} 127<a class="l" name="121" href="#121">121</a> 128<a class="l" name="122" href="#122">122</a><b>func</b> (<a href="/source/s?defs=r" class="intelliWindow-symbol" data-definition-place="undefined-in-file">r</a> *<a href="/source/s?defs=Reader" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Reader</a>) <a class="d" name="readFromStdin"/><a href="/source/s?refs=readFromStdin" class="d intelliWindow-symbol" data-definition-place="def">readFromStdin</a>() <b>bool</b> { 129<a class="l" name="123" href="#123">123</a> <a href="/source/s?defs=r" class="intelliWindow-symbol" data-definition-place="undefined-in-file">r</a>.<a class="d intelliWindow-symbol" href="#feed" data-definition-place="defined-in-file">feed</a>(<a href="/source/s?defs=os" class="intelliWindow-symbol" data-definition-place="undefined-in-file">os</a>.<a href="/source/s?defs=Stdin" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Stdin</a>) 130<a class="l" name="124" href="#124">124</a> <b>return</b> <b>true</b> 131<a class="l" name="125" href="#125">125</a>} 132<a class="l" name="126" href="#126">126</a> 133<a class="l" name="127" href="#127">127</a><b>func</b> (<a href="/source/s?defs=r" class="intelliWindow-symbol" data-definition-place="undefined-in-file">r</a> *<a href="/source/s?defs=Reader" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Reader</a>) <a class="d" name="readFromCommand"/><a href="/source/s?refs=readFromCommand" class="d intelliWindow-symbol" data-definition-place="def">readFromCommand</a>(<a href="/source/s?defs=shell" class="intelliWindow-symbol" data-definition-place="undefined-in-file">shell</a> <b>string</b>, <a href="/source/s?defs=cmd" class="intelliWindow-symbol" data-definition-place="undefined-in-file">cmd</a> <b>string</b>) <b>bool</b> { 134<a class="l" name="128" href="#128">128</a> <a href="/source/s?defs=listCommand" class="intelliWindow-symbol" data-definition-place="undefined-in-file">listCommand</a> := <a href="/source/s?defs=util" class="intelliWindow-symbol" data-definition-place="undefined-in-file">util</a>.<a href="/source/s?defs=ExecCommandWith" class="intelliWindow-symbol" data-definition-place="undefined-in-file">ExecCommandWith</a>(<a href="/source/s?defs=shell" class="intelliWindow-symbol" data-definition-place="undefined-in-file">shell</a>, <a href="/source/s?defs=cmd" class="intelliWindow-symbol" data-definition-place="undefined-in-file">cmd</a>) 135<a class="l" name="129" href="#129">129</a> <a href="/source/s?defs=out" class="intelliWindow-symbol" data-definition-place="undefined-in-file">out</a>, <a href="/source/s?defs=err" class="intelliWindow-symbol" data-definition-place="undefined-in-file">err</a> := <a href="/source/s?defs=listCommand" class="intelliWindow-symbol" data-definition-place="undefined-in-file">listCommand</a>.<a href="/source/s?defs=StdoutPipe" class="intelliWindow-symbol" data-definition-place="undefined-in-file">StdoutPipe</a>() 136<a class="hl" name="130" href="#130">130</a> <b>if</b> <a href="/source/s?defs=err" class="intelliWindow-symbol" data-definition-place="undefined-in-file">err</a> != <b>nil</b> { 137<a class="l" name="131" href="#131">131</a> <b>return</b> <b>false</b> 138<a class="l" name="132" href="#132">132</a> } 139<a class="l" name="133" href="#133">133</a> <a href="/source/s?defs=err" class="intelliWindow-symbol" data-definition-place="undefined-in-file">err</a> = <a href="/source/s?defs=listCommand" class="intelliWindow-symbol" data-definition-place="undefined-in-file">listCommand</a>.<a href="/source/s?defs=Start" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Start</a>() 140<a class="l" name="134" href="#134">134</a> <b>if</b> <a href="/source/s?defs=err" class="intelliWindow-symbol" data-definition-place="undefined-in-file">err</a> != <b>nil</b> { 141<a class="l" name="135" href="#135">135</a> <b>return</b> <b>false</b> 142<a class="l" name="136" href="#136">136</a> } 143<a class="l" name="137" href="#137">137</a> <a href="/source/s?defs=r" class="intelliWindow-symbol" data-definition-place="undefined-in-file">r</a>.<a class="d intelliWindow-symbol" href="#feed" data-definition-place="defined-in-file">feed</a>(<a href="/source/s?defs=out" class="intelliWindow-symbol" data-definition-place="undefined-in-file">out</a>) 144<a class="l" name="138" href="#138">138</a> <b>return</b> <a href="/source/s?defs=listCommand" class="intelliWindow-symbol" data-definition-place="undefined-in-file">listCommand</a>.<a href="/source/s?defs=Wait" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Wait</a>() == <b>nil</b> 145<a class="l" name="139" href="#139">139</a>} 146<a class="hl" name="140" href="#140">140</a><span class="c">/*<a href="http://example.com">http://example.com</a>*/</span> 147<a class="l" name="141" href="#141">141</a><b>import</b> (<span class="s">'<a href="http://example.com">http://example.com</a>'</span>) 148<a class="l" name="142" href="#142">142</a></body> 149</html> 150