wiki/lang.oil.processes.html

26 lines
7.3 KiB
HTML
Raw Permalink Normal View History

2022-07-29 15:41:17 +00:00
<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width"/><meta charSet="utf-8"/><title>Oil processes</title><script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script><script id="MathJax-script" async="" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script><script type="text/x-mathjax-config">
MathJax = {
tex: {
inlineMath: [ [&#x27;$&#x27;,&#x27;$&#x27;], [&#x27;\(&#x27;,&#x27;\)&#x27;] ],
displayMath: [ [&#x27;$$&#x27;,&#x27;$$&#x27;], [&#x27;[&#x27;,&#x27;]&#x27;] ]
},
options = {
processHtmlClass = &quot;math&quot;
}
}
</script><meta name="next-head-count" content="6"/><link rel="preload" href="/wiki/_next/static/css/52fc2ba29703df73922c.css" as="style"/><link rel="stylesheet" href="/wiki/_next/static/css/52fc2ba29703df73922c.css" data-n-g=""/><noscript data-n-css=""></noscript><link rel="preload" href="/wiki/_next/static/chunks/main-ae4733327bd95c4ac325.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/webpack-50bee04d1dc61f8adf5b.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/framework.9d524150d48315f49e80.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/commons.0e1c3f9aa780c2dfe9f0.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/pages/_app-8e3d0c58a60ec788aa69.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/940643274e605e7596ecea1f2ff8d83317a3fb76.4841a16762f602a59f00.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/pages/%5B%5B...slug%5D%5D-1aa198f87ede1cd0e1dc.js" as="script"/></head><body><div id="__next"><main><h1>Oil processes</h1><section class="post-metadata"><span>Date: <!-- -->2021-08-08 16:02:37 +08:00</span><span>Date modified: <!-- -->2021-08-09 00:17:41 +08:00</span></section><nav class="toc"><ol class="toc-level toc-level-1"></ol></nav><p>Oil has an alternative way for managing processes.
</p><p>The biggest difference is the <code class="inline-verbatim">fork</code> and <code class="inline-verbatim">forkwait</code> keyword which are blocks.
</p><pre class="src-block"><code class="language-oil">fork {
sleep 4
write -- &quot;Hello world&quot;
}
forkwait {
sleep 4
write -- &quot;Hello world 2&quot;
}
</code></pre><ul><li><p><code class="inline-verbatim">fork</code> is the alternative to the <code class="inline-verbatim">&amp;</code> operator (e.g., <code class="inline-code">sleep 6 &amp;</code>) which can be blocked with the <code class="inline-verbatim">wait</code> keyword.
</p></li><li><p><code class="inline-verbatim">forkwait</code> is the proposed alternative for subshells.
</p></li><li><p><code class="inline-verbatim">jobs</code> views the jobs and processes of the shell.
</p></li><li><p><code class="inline-verbatim">fg</code> brings a job into the foreground.
</p></li></ul></main></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"metadata":{"date":"2021-08-08 16:02:37 +08:00","date_modified":"2021-08-09 00:17:41 +08:00","language":"en","source":""},"title":"Oil processes","hast":{"type":"root","children":[{"type":"element","tagName":"nav","properties":{"className":"toc"},"children":[{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-1"},"children":[]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Oil has an alternative way for managing processes.\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The biggest difference is the "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"fork"}]},{"type":"text","value":" and "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"forkwait"}]},{"type":"text","value":" keyword which are blocks.\n"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-oil"]},"children":[{"type":"text","value":"fork {\n sleep 4\n write -- \"Hello world\"\n}\n\nforkwait {\n sleep 4\n write -- \"Hello world 2\"\n}\n"}]}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"fork"}]},{"type":"text","value":" is the alternative to the "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"\u0026"}]},{"type":"text","value":" operator (e.g., "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"sleep 6 \u0026"}]},{"type":"text","value":") which can be blocked with the "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"wait"}]},{"type":"text","value":" keyword.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"forkwait"}]},{"type":"text","value":" is the proposed alternative for subshells.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"jobs"}]},{"type":"text","value":" views the jobs and processes of the shell.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"fg"}]},{"type":"text","value":" brings a job into the foreground.\n"}]}]}]}]},"backlinks":[]},"__N_SSG":true},"page":"/[[...slug]]","query":{"slug":["lang.oil.processes"]},"buildId":"Ie9t5zutrXP6Of75Cb5xF","assetPrefix":"/wiki","nextExport":false,"isFallback":false,"gsp":true}</script><script nomodule="" src="/wiki/_next/static/chunks/polyfills-99d808df29361cf7ffb1.js"></script><script src="/wiki/_next/static/chunks/main-ae4733327bd95c4ac325.js" async=""></script><script src="/wiki/_next/static/chunks/webpack-50bee04d1dc61f8adf5b.js" async=""></script><script src="/wiki/_next/static/chunks/framework.9d524150d48315f49e80.js" async=""></script><script src="/wiki/_next/static/chunks/commons.0e1c3f9aa780c2dfe9f0.js" async=""></script><script src="/wiki/_next/static/chunks/pages/_app-8e3d0c58a60ec788aa69.js" async=""></script><script src="/wiki/_next/static/chunks/940643274e605e7596ecea1f2ff8d83317a3fb76.4841a16762f