Skip to content

Commit

Permalink
Clean up process object descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Grant Heaslip committed Jul 6, 2011
1 parent fdf60a0 commit 65f2cdd
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 42 deletions.
28 changes: 14 additions & 14 deletions book.html
Expand Up @@ -349,32 +349,32 @@ <h3 id="console-assert-">console.assert()</h3>

<h2 id="process">process</h2>

<p>The <code>process</code> object is plastered with goodies, first we will take a look
at some properties that provide information about the node process itself.</p>
<p>The <code>process</code> object is plastered with goodies. First we will take a look
at some properties that provide information about the node process itself:</p>

<h3 id="process-version">process.version</h3>

<p>The version property contains the node version string, for example "v0.1.103".</p>
<p>The node version string, for example "v0.1.103".</p>

<h3 id="process-installPrefix">process.installPrefix</h3>

<p>Exposes the installation prefix, in my case "<em>/usr/local</em>", as node's binary was installed to "<em>/usr/local/bin/node</em>".</p>
<p>The installation prefix. In my case "<em>/usr/local</em>", as node's binary was installed to "<em>/usr/local/bin/node</em>".</p>

<h3 id="process-execPath">process.execPath</h3>

<p>Path to the executable itself "<em>/usr/local/bin/node</em>".</p>
<p>The path to the executable itself "<em>/usr/local/bin/node</em>".</p>

<h3 id="process-platform">process.platform</h3>

<p>Exposes a string indicating the platform you are running on, for example "darwin".</p>
<p>The platform you are running on. For example, "darwin".</p>

<h3 id="process-pid">process.pid</h3>

<p>The process id.</p>

<h3 id="process-cwd-">process.cwd()</h3>

<p>Returns the current working directory, for example:</p>
<p>Returns the current working directory. For example:</p>

<pre><code>cd ~ &amp;&amp; node
node&gt; process.cwd()
Expand Down Expand Up @@ -402,11 +402,11 @@ <h3 id="process-getgid-">process.getgid()</h3>

<h3 id="process-setgid-">process.setgid()</h3>

<p>Similar to <code>process.setuid()</code> however operates on the group, also accepting a numerical value or string representation. For example <code>process.setgid(20)</code> or <code>process.setgid('www')</code>.</p>
<p>Similar to <code>process.setuid()</code> however operates on the group, also accepting a numerical value or string representation. For example, <code>process.setgid(20)</code> or <code>process.setgid('www')</code>.</p>

<h3 id="process-env">process.env</h3>

<p>An object containing the user's environment variables, for example:</p>
<p>An object containing the user's environment variables. For example:</p>

<pre><code>{ PATH: '/Users/tj/.gem/ruby/1.8/bin:/Users/tj/.nvm/current/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin'
, PWD: '/Users/tj/ebooks/masteringnode'
Expand All @@ -425,7 +425,7 @@ <h3 id="process-argv">process.argv</h3>

<p>When executing a file with the <code>node</code> executable <code>process.argv</code> provides access to the argument vector, the first value being the node executable, second being the filename, and remaining values being the arguments passed.</p>

<p>For example our source file <em>./src/process/misc.js</em> can be executed by running:</p>
<p>For example, our source file <em>./src/process/misc.js</em> can be executed by running:</p>

<pre><code>$ node src/process/misc.js foo bar baz
</code></pre>
Expand All @@ -442,11 +442,11 @@ <h3 id="process-argv">process.argv</h3>

<h3 id="process-exit-">process.exit()</h3>

<p>The <code>process.exit()</code> method is synonymous with the C function <code>exit()</code>, in which a exit code > 0 is passed indicating failure, or 0 to indicate success. When invoked the <em>exit</em> event is emitted, allowing a short time for arbitrary processing to occur before <code>process.reallyExit()</code> is called with the given status code.</p>
<p>The <code>process.exit()</code> method is synonymous with the C function <code>exit()</code>, in which an exit code > 0 is passed to indicate failure, or 0 is passed to indicate success. When invoked, the <em>exit</em> event is emitted, allowing a short time for arbitrary processing to occur before <code>process.reallyExit()</code> is called with the given status code.</p>

<h3 id="process-on-">process.on()</h3>

<p>The process itself is an <code>EventEmitter</code>, allowing you to do things like listen for uncaught exceptions, via the <em>uncaughtException</em> event:</p>
<p>The process itself is an <code>EventEmitter</code>, allowing you to do things like listen for uncaught exceptions via the <em>uncaughtException</em> event:</p>

<pre><code>process.on('uncaughtException', function(err){
console.log('got an error: %s', err.message);
Expand All @@ -460,7 +460,7 @@ <h3 id="process-on-">process.on()</h3>

<h3 id="process-kill-">process.kill()</h3>

<p><code>process.kill()</code> method sends the signal passed to the given <em>pid</em>, defaulting to <strong>SIGINT</strong>. In our example below we send the <strong>SIGTERM</strong> signal to the same node process to illustrate signal trapping, after which we output "terminating" and exit. Note that our second timeout of 1000 milliseconds is never reached.</p>
<p><code>process.kill()</code> method sends the signal passed to the given <em>pid</em>, defaulting to <strong>SIGINT</strong>. In the example below, we send the <strong>SIGTERM</strong> signal to the same node process to illustrate signal trapping, after which we output "terminating" and exit. Note that the second timeout of 1000 milliseconds is never reached.</p>

<pre><code>process.on('SIGTERM', function(){
console.log('terminating');
Expand All @@ -479,7 +479,7 @@ <h3 id="process-kill-">process.kill()</h3>

<h3 id="errno">errno</h3>

<p>The <code>process</code> object is host of the error numbers, these reference what you would find in C-land, for example <code>process.EPERM</code> represents a permission based error, while <code>process.ENOENT</code> represents a missing file or directory. Typically these are used within bindings to bridge the gap between C++ and JavaScript, however useful for handling exceptions as well:</p>
<p>The <code>process</code> object is host of the error numbers, which reference what you would find in C-land. For example, <code>process.EPERM</code> represents a permission based error, while <code>process.ENOENT</code> represents a missing file or directory. Typically these are used within bindings to bridge the gap between C++ and JavaScript, but they're useful for handling exceptions as well:</p>

<pre><code>if (err.errno === process.ENOENT) {
// Display a 404 "Not Found" page
Expand Down
28 changes: 14 additions & 14 deletions chapters/globals.html
Expand Up @@ -42,32 +42,32 @@ <h3 id="console-assert-">console.assert()</h3>

<h2 id="process">process</h2>

<p>The <code>process</code> object is plastered with goodies, first we will take a look
at some properties that provide information about the node process itself.</p>
<p>The <code>process</code> object is plastered with goodies. First we will take a look
at some properties that provide information about the node process itself:</p>

<h3 id="process-version">process.version</h3>

<p>The version property contains the node version string, for example "v0.1.103".</p>
<p>The node version string, for example "v0.1.103".</p>

<h3 id="process-installPrefix">process.installPrefix</h3>

<p>Exposes the installation prefix, in my case "<em>/usr/local</em>", as node's binary was installed to "<em>/usr/local/bin/node</em>".</p>
<p>The installation prefix. In my case "<em>/usr/local</em>", as node's binary was installed to "<em>/usr/local/bin/node</em>".</p>

<h3 id="process-execPath">process.execPath</h3>

<p>Path to the executable itself "<em>/usr/local/bin/node</em>".</p>
<p>The path to the executable itself "<em>/usr/local/bin/node</em>".</p>

<h3 id="process-platform">process.platform</h3>

<p>Exposes a string indicating the platform you are running on, for example "darwin".</p>
<p>The platform you are running on. For example, "darwin".</p>

<h3 id="process-pid">process.pid</h3>

<p>The process id.</p>

<h3 id="process-cwd-">process.cwd()</h3>

<p>Returns the current working directory, for example:</p>
<p>Returns the current working directory. For example:</p>

<pre><code>cd ~ &amp;&amp; node
node&gt; process.cwd()
Expand Down Expand Up @@ -95,11 +95,11 @@ <h3 id="process-getgid-">process.getgid()</h3>

<h3 id="process-setgid-">process.setgid()</h3>

<p>Similar to <code>process.setuid()</code> however operates on the group, also accepting a numerical value or string representation. For example <code>process.setgid(20)</code> or <code>process.setgid('www')</code>.</p>
<p>Similar to <code>process.setuid()</code> however operates on the group, also accepting a numerical value or string representation. For example, <code>process.setgid(20)</code> or <code>process.setgid('www')</code>.</p>

<h3 id="process-env">process.env</h3>

<p>An object containing the user's environment variables, for example:</p>
<p>An object containing the user's environment variables. For example:</p>

<pre><code>{ PATH: '/Users/tj/.gem/ruby/1.8/bin:/Users/tj/.nvm/current/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin'
, PWD: '/Users/tj/ebooks/masteringnode'
Expand All @@ -118,7 +118,7 @@ <h3 id="process-argv">process.argv</h3>

<p>When executing a file with the <code>node</code> executable <code>process.argv</code> provides access to the argument vector, the first value being the node executable, second being the filename, and remaining values being the arguments passed.</p>

<p>For example our source file <em>./src/process/misc.js</em> can be executed by running:</p>
<p>For example, our source file <em>./src/process/misc.js</em> can be executed by running:</p>

<pre><code>$ node src/process/misc.js foo bar baz
</code></pre>
Expand All @@ -135,11 +135,11 @@ <h3 id="process-argv">process.argv</h3>

<h3 id="process-exit-">process.exit()</h3>

<p>The <code>process.exit()</code> method is synonymous with the C function <code>exit()</code>, in which a exit code > 0 is passed indicating failure, or 0 to indicate success. When invoked the <em>exit</em> event is emitted, allowing a short time for arbitrary processing to occur before <code>process.reallyExit()</code> is called with the given status code.</p>
<p>The <code>process.exit()</code> method is synonymous with the C function <code>exit()</code>, in which an exit code > 0 is passed to indicate failure, or 0 is passed to indicate success. When invoked, the <em>exit</em> event is emitted, allowing a short time for arbitrary processing to occur before <code>process.reallyExit()</code> is called with the given status code.</p>

<h3 id="process-on-">process.on()</h3>

<p>The process itself is an <code>EventEmitter</code>, allowing you to do things like listen for uncaught exceptions, via the <em>uncaughtException</em> event:</p>
<p>The process itself is an <code>EventEmitter</code>, allowing you to do things like listen for uncaught exceptions via the <em>uncaughtException</em> event:</p>

<pre><code>process.on('uncaughtException', function(err){
console.log('got an error: %s', err.message);
Expand All @@ -153,7 +153,7 @@ <h3 id="process-on-">process.on()</h3>

<h3 id="process-kill-">process.kill()</h3>

<p><code>process.kill()</code> method sends the signal passed to the given <em>pid</em>, defaulting to <strong>SIGINT</strong>. In our example below we send the <strong>SIGTERM</strong> signal to the same node process to illustrate signal trapping, after which we output "terminating" and exit. Note that our second timeout of 1000 milliseconds is never reached.</p>
<p><code>process.kill()</code> method sends the signal passed to the given <em>pid</em>, defaulting to <strong>SIGINT</strong>. In the example below, we send the <strong>SIGTERM</strong> signal to the same node process to illustrate signal trapping, after which we output "terminating" and exit. Note that the second timeout of 1000 milliseconds is never reached.</p>

<pre><code>process.on('SIGTERM', function(){
console.log('terminating');
Expand All @@ -172,7 +172,7 @@ <h3 id="process-kill-">process.kill()</h3>

<h3 id="errno">errno</h3>

<p>The <code>process</code> object is host of the error numbers, these reference what you would find in C-land, for example <code>process.EPERM</code> represents a permission based error, while <code>process.ENOENT</code> represents a missing file or directory. Typically these are used within bindings to bridge the gap between C++ and JavaScript, however useful for handling exceptions as well:</p>
<p>The <code>process</code> object is host of the error numbers, which reference what you would find in C-land. For example, <code>process.EPERM</code> represents a permission based error, while <code>process.ENOENT</code> represents a missing file or directory. Typically these are used within bindings to bridge the gap between C++ and JavaScript, but they're useful for handling exceptions as well:</p>

<pre><code>if (err.errno === process.ENOENT) {
// Display a 404 "Not Found" page
Expand Down
28 changes: 14 additions & 14 deletions chapters/globals.md
Expand Up @@ -39,32 +39,32 @@ Asserts that the given expression is truthy, or throws an exception.

## process

The `process` object is plastered with goodies, first we will take a look
at some properties that provide information about the node process itself.
The `process` object is plastered with goodies. First we will take a look
at some properties that provide information about the node process itself:

### process.version

The version property contains the node version string, for example "v0.1.103".
The node version string, for example "v0.1.103".

### process.installPrefix

Exposes the installation prefix, in my case "_/usr/local_", as node's binary was installed to "_/usr/local/bin/node_".
The installation prefix. In my case "_/usr/local_", as node's binary was installed to "_/usr/local/bin/node_".

### process.execPath

Path to the executable itself "_/usr/local/bin/node_".
The path to the executable itself "_/usr/local/bin/node_".

### process.platform

Exposes a string indicating the platform you are running on, for example "darwin".
The platform you are running on. For example, "darwin".

### process.pid

The process id.

### process.cwd()

Returns the current working directory, for example:
Returns the current working directory. For example:

cd ~ && node
node> process.cwd()
Expand All @@ -90,11 +90,11 @@ Returns the numerical group id of the running process.

### process.setgid()

Similar to `process.setuid()` however operates on the group, also accepting a numerical value or string representation. For example `process.setgid(20)` or `process.setgid('www')`.
Similar to `process.setuid()` however operates on the group, also accepting a numerical value or string representation. For example, `process.setgid(20)` or `process.setgid('www')`.

### process.env

An object containing the user's environment variables, for example:
An object containing the user's environment variables. For example:

{ PATH: '/Users/tj/.gem/ruby/1.8/bin:/Users/tj/.nvm/current/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin'
, PWD: '/Users/tj/ebooks/masteringnode'
Expand All @@ -112,7 +112,7 @@ An object containing the user's environment variables, for example:

When executing a file with the `node` executable `process.argv` provides access to the argument vector, the first value being the node executable, second being the filename, and remaining values being the arguments passed.

For example our source file _./src/process/misc.js_ can be executed by running:
For example, our source file _./src/process/misc.js_ can be executed by running:

$ node src/process/misc.js foo bar baz

Expand All @@ -127,11 +127,11 @@ in which we call `console.dir(process.argv)`, outputting the following:

### process.exit()

The `process.exit()` method is synonymous with the C function `exit()`, in which a exit code > 0 is passed indicating failure, or 0 to indicate success. When invoked the _exit_ event is emitted, allowing a short time for arbitrary processing to occur before `process.reallyExit()` is called with the given status code.
The `process.exit()` method is synonymous with the C function `exit()`, in which an exit code > 0 is passed to indicate failure, or 0 is passed to indicate success. When invoked, the _exit_ event is emitted, allowing a short time for arbitrary processing to occur before `process.reallyExit()` is called with the given status code.

### process.on()

The process itself is an `EventEmitter`, allowing you to do things like listen for uncaught exceptions, via the _uncaughtException_ event:
The process itself is an `EventEmitter`, allowing you to do things like listen for uncaught exceptions via the _uncaughtException_ event:

process.on('uncaughtException', function(err){
console.log('got an error: %s', err.message);
Expand All @@ -144,7 +144,7 @@ The process itself is an `EventEmitter`, allowing you to do things like listen f

### process.kill()

`process.kill()` method sends the signal passed to the given _pid_, defaulting to **SIGINT**. In our example below we send the **SIGTERM** signal to the same node process to illustrate signal trapping, after which we output "terminating" and exit. Note that our second timeout of 1000 milliseconds is never reached.
`process.kill()` method sends the signal passed to the given _pid_, defaulting to **SIGINT**. In the example below, we send the **SIGTERM** signal to the same node process to illustrate signal trapping, after which we output "terminating" and exit. Note that the second timeout of 1000 milliseconds is never reached.

process.on('SIGTERM', function(){
console.log('terminating');
Expand All @@ -162,7 +162,7 @@ The process itself is an `EventEmitter`, allowing you to do things like listen f

### errno

The `process` object is host of the error numbers, these reference what you would find in C-land, for example `process.EPERM` represents a permission based error, while `process.ENOENT` represents a missing file or directory. Typically these are used within bindings to bridge the gap between C++ and JavaScript, however useful for handling exceptions as well:
The `process` object is host of the error numbers, which reference what you would find in C-land. For example, `process.EPERM` represents a permission based error, while `process.ENOENT` represents a missing file or directory. Typically these are used within bindings to bridge the gap between C++ and JavaScript, but they're useful for handling exceptions as well:

if (err.errno === process.ENOENT) {
// Display a 404 "Not Found" page
Expand Down

0 comments on commit 65f2cdd

Please sign in to comment.