Skip to content

Commit

Permalink
Fix wrong exit status output
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuichiueda committed Apr 1, 2017
1 parent 601b550 commit 60b0fb6
Show file tree
Hide file tree
Showing 17 changed files with 324 additions and 4 deletions.
63 changes: 63 additions & 0 deletions docs/_sources/error.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
========================================
Toward errors
========================================

We think that conventional shells have poor functions toward errors. GlueLang will be enpowered to have strong error handling features. As such the feature, GlueLang does not return the exit status given by the last command differently from bash or sh. This nature will help us to detect the cause of errors.

Exit statuses
========================================

The following table shows the list of exit statuses.


.. list-table:: Exit statuses
:widths: 40 20
:header-rows: 1

* - Statuses
- Numbers
* - A command gives non-zero exit status.
- 1
* - A command cannot be found from the shell.
- 2
* - An argument is used without definition.
- 3
* - The folk system call causes an error.
- 4
* - The current directory is not obtained.
- 5
* - ``>>`` is connected after ``?>``
- 6
* - An unknown token is written in the script.
- 7
* - An error occured in a then (``?>``) part.
- 8
* - Unknown parse error.
- 128
* - End by a signal (not implemented yet)
- 128 + the signal number

Error messages
========================================

When an error occurs, the script stop immediately and gives a message. Here is an example.

.. code-block:: bash

$ cat simple_error.glue
import PATH

diff

$ glue ./simple_error.glue
(snip)
Execution error at line 3, char 1
line3: diff
^

Command error
process_level 0
exit_status 2
pid 90120
ERROR: 2

1 change: 1 addition & 0 deletions docs/_sources/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ Contents:
connection
block
job
error
177 changes: 177 additions & 0 deletions docs/error.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>8. Toward errors &mdash; GlueLangDocs 0.0.1 documentation</title>

<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />

<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.0.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="GlueLangDocs 0.0.1 documentation" href="index.html" />
<link rel="prev" title="7. Background processes" href="job.html" />


<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">

</head>
<body role="document">

<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">

<div class="section" id="toward-errors">
<h1>8. Toward errors<a class="headerlink" href="#toward-errors" title="Permalink to this headline"></a></h1>
<p>We think that conventional shells have poor functions toward errors. GlueLang will be enpowered to have strong error handling features. As such the feature, GlueLang does not return the exit status given by the last command differently from bash or sh. This nature will help us to detect the cause of errors.</p>
<div class="section" id="exit-statuses">
<h2>8.1. Exit statuses<a class="headerlink" href="#exit-statuses" title="Permalink to this headline"></a></h2>
<p>The following table shows the list of exit statuses.</p>
<table border="1" class="docutils" id="id1">
<caption><span class="caption-text">Exit statuses</span><a class="headerlink" href="#id1" title="Permalink to this table"></a></caption>
<colgroup>
<col width="67%" />
<col width="33%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Statuses</th>
<th class="head">Numbers</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>A command gives non-zero exit status.</td>
<td>1</td>
</tr>
<tr class="row-odd"><td>A command cannot be found from the shell.</td>
<td>2</td>
</tr>
<tr class="row-even"><td>An argument is used without definition.</td>
<td>3</td>
</tr>
<tr class="row-odd"><td>The folk system call causes an error.</td>
<td>4</td>
</tr>
<tr class="row-even"><td>The current directory is not obtained.</td>
<td>5</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">&gt;&gt;</span></code> is connected after <code class="docutils literal"><span class="pre">?&gt;</span></code></td>
<td>6</td>
</tr>
<tr class="row-even"><td>An unknown token is written in the script.</td>
<td>7</td>
</tr>
<tr class="row-odd"><td>An error occured in a then (<code class="docutils literal"><span class="pre">?&gt;</span></code>) part.</td>
<td>8</td>
</tr>
<tr class="row-even"><td>Unknown parse error.</td>
<td>128</td>
</tr>
<tr class="row-odd"><td>End by a signal (not implemented yet)</td>
<td>128 + the signal number</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="error-messages">
<h2>8.2. Error messages<a class="headerlink" href="#error-messages" title="Permalink to this headline"></a></h2>
<p>When an error occurs, the script stop immediately and gives a message. Here is an example.</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>cat simple_error.glue
import PATH

diff

<span class="nv">$ </span>glue ./simple_error.glue
<span class="o">(</span>snip<span class="o">)</span>
Execution error at line 3, char 1
line3: diff
^

Command error
process_level 0
exit_status 2
pid 90120
ERROR: 2
</pre></div>
</div>
</div>
</div>


</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">8. Toward errors</a><ul>
<li><a class="reference internal" href="#exit-statuses">8.1. Exit statuses</a></li>
<li><a class="reference internal" href="#error-messages">8.2. Error messages</a></li>
</ul>
</li>
</ul>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
<li>Previous: <a href="job.html" title="previous chapter">7. Background processes</a></li>
</ul></li>
</ul>
</div>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/error.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
&copy;2017, Ryuichi Ueda.

|
Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.6</a>

|
<a href="_sources/error.txt"
rel="nofollow">Page source</a>
</div>




</body>
</html>
5 changes: 5 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ <h1>GlueLang User&#8217;s Manual<a class="headerlink" href="#gluelang-user-s-man
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="job.html">7. Background processes</a></li>
<li class="toctree-l1"><a class="reference internal" href="error.html">8. Toward errors</a><ul>
<li class="toctree-l2"><a class="reference internal" href="error.html#exit-statuses">8.1. Exit statuses</a></li>
<li class="toctree-l2"><a class="reference internal" href="error.html#error-messages">8.2. Error messages</a></li>
</ul>
</li>
</ul>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions docs/job.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="GlueLangDocs 0.0.1 documentation" href="index.html" />
<link rel="next" title="8. Toward errors" href="error.html" />
<link rel="prev" title="6. Blocks and procedures" href="block.html" />


Expand Down Expand Up @@ -87,6 +88,7 @@ <h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
<li>Previous: <a href="block.html" title="previous chapter">6. Blocks and procedures</a></li>
<li>Next: <a href="error.html" title="next chapter">8. Toward errors</a></li>
</ul></li>
</ul>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/searchindex.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified manual_src/_build/doctrees/environment.pickle
Binary file not shown.
Binary file added manual_src/_build/doctrees/error.doctree
Binary file not shown.
Binary file modified manual_src/_build/doctrees/index.doctree
Binary file not shown.
Loading

0 comments on commit 60b0fb6

Please sign in to comment.