|
From: <cr...@us...> - 2009-06-09 14:05:21
|
Revision: 5565
http://jnode.svn.sourceforge.net/jnode/?rev=5565&view=rev
Author: crawley
Date: 2009-06-09 12:33:55 +0000 (Tue, 09 Jun 2009)
Log Message:
-----------
Fix brace group parse bug, and "echo hi | aa=bb" bug.
Modified Paths:
--------------
trunk/shell/src/shell/org/jnode/shell/bjorne/BjorneParser.java
trunk/shell/src/shell/org/jnode/shell/bjorne/BjornePipeline.java
trunk/shell/src/shell/org/jnode/shell/bjorne/SimpleCommandNode.java
trunk/shell/src/test/org/jnode/test/shell/bjorne/bjorne-shell-tests.xml
Modified: trunk/shell/src/shell/org/jnode/shell/bjorne/BjorneParser.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/bjorne/BjorneParser.java 2009-06-08 13:48:09 UTC (rev 5564)
+++ trunk/shell/src/shell/org/jnode/shell/bjorne/BjorneParser.java 2009-06-09 12:33:55 UTC (rev 5565)
@@ -501,7 +501,7 @@
private CommandNode parseBraceGroup() throws ShellSyntaxException {
next();
CommandNode compoundList = parseCompoundList(TOK_RBRACE_BIT);
- expectPeek(TOK_RBRACE_BIT);
+ expectNext(TOK_RBRACE_BIT, RULE_1_CONTEXT);
compoundList.setNodeType(CMD_BRACE_GROUP);
return compoundList;
}
Modified: trunk/shell/src/shell/org/jnode/shell/bjorne/BjornePipeline.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/bjorne/BjornePipeline.java 2009-06-08 13:48:09 UTC (rev 5564)
+++ trunk/shell/src/shell/org/jnode/shell/bjorne/BjornePipeline.java 2009-06-09 12:33:55 UTC (rev 5565)
@@ -161,7 +161,11 @@
synchronized (this) {
for (PipelineStage stage : stages) {
ThreadCallback callback = new ThreadCallback(stage.context);
- stage.thread.start(callback);
+ if (stage.thread != null) {
+ stage.thread.start(callback);
+ } else {
+ callback.notifyThreadExited(null);
+ }
}
while (activeStageCount > 0) {
try {
@@ -171,7 +175,8 @@
break;
}
}
- return stages[stages.length - 1].thread.getReturnCode();
+ CommandThread lastThread = stages[stages.length - 1].thread;
+ return (lastThread == null) ? 0 : lastThread.getReturnCode();
}
}
Modified: trunk/shell/src/shell/org/jnode/shell/bjorne/SimpleCommandNode.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/bjorne/SimpleCommandNode.java 2009-06-08 13:48:09 UTC (rev 5564)
+++ trunk/shell/src/shell/org/jnode/shell/bjorne/SimpleCommandNode.java 2009-06-09 12:33:55 UTC (rev 5565)
@@ -127,9 +127,13 @@
public CommandThread fork(CommandShell shell, BjorneContext context)
throws ShellException {
- CommandLine command = context.buildCommandLine(getWords());
- command.setStreams(context.getIOs());
- return shell.invokeAsynchronous(command);
+ if (words.length > 0) {
+ CommandLine command = context.buildCommandLine(words);
+ command.setStreams(context.getIOs());
+ return shell.invokeAsynchronous(command);
+ } else {
+ return null;
+ }
}
@Override
Modified: trunk/shell/src/test/org/jnode/test/shell/bjorne/bjorne-shell-tests.xml
===================================================================
--- trunk/shell/src/test/org/jnode/test/shell/bjorne/bjorne-shell-tests.xml 2009-06-08 13:48:09 UTC (rev 5564)
+++ trunk/shell/src/test/org/jnode/test/shell/bjorne/bjorne-shell-tests.xml 2009-06-09 12:33:55 UTC (rev 5565)
@@ -775,6 +775,11 @@
<output>Hi
</output>
</testSpec>
+ <testSpec title="weird pipeline" command="test" runMode="AS_SCRIPT" rc="0">
+ <script>#!bjorne
+ echo Hi | aa=bb
+ </script>
+ </testSpec>
<testSpec title="subshell" command="test" runMode="AS_SCRIPT" rc="0">
<script>#!bjorne
echo > @TEMP_DIR@/1 Hi mum
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|