sleyzerzon / soar

Automatically exported from code.google.com/p/soar
1 stars 0 forks source link

'quit' command not working #116

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. start the cli.exe program
2.enter 'quit' , which does not work
3.enter 'help' and see that 'quit' and 'exit' are not present
4. create a source text file (e.g. x.txt) which contains either 'quit' or 'exit'
and invoke "cli.exe -s x.txt' and observe that neither command works.

What is the expected output? - normal exit from batch-invoked cli.exe input 
source file.
What do you see instead?
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\SOAR\SoarWin64\bin>cli.exe

% help
Available commands:

add-wme
alias
allocate
capture-input
cd
chunk-name-format
clog
command-to-file
default-wme-depth
dirs
echo
echo-commands
edit-production
epmem
excise
explain-backtraces
firing-counts
gds-print
gp
gp-max
help
indifferent-selection
init-soar
internal-symbols
learn
load-library
ls
matches
max-chunks
max-dc-time
max-elaborations
max-goal-depth
max-memory-usage
max-nil-output-cycles
memories
multi-attributes
numeric-indifferent-mode
o-support-mode
popd
port
predict
preferences
print
production-find
pushd
pwatch
pwd
rand
remove-wme
replay-input
rete-net
rl
run
save-backtraces
select
set-library-location
set-stop-phase
smem
soarnews
source
sp
srand
stats
stop-soar
time
timers
unalias
verbose
version
waitsnc
warnings
watch
watch-wmes
wma

% source C:/Soar/SoarWin64/bin/test_agents/hello-world-operator.soar
**
Total: 2 productions sourced.

% run
     1:    O: O1 (hello-world)
Hello World
System halted.
Interrupt received.This Agent halted.
An agent halted during the run.

% exit

C:\SOAR\SoarWin64\bin>cli /?
Error: No such command: /?

C:\SOAR\SoarWin64\bin>cli --help
usage: cli [-o] [-n <agent name>] [-p <port>] [-s <source>] <commands> ...

C:\SOAR\SoarWin64\bin>x-hw-1
'x-hw-1' is not recognized as an internal or external command,
operable program or batch file.

C:\SOAR\SoarWin64\bin>dir x*.bat
 Volume in drive C is OS
 Volume Serial Number is E280-7C84

 Directory of C:\SOAR\SoarWin64\bin

File Not Found

C:\SOAR\SoarWin64\bin>dir x*.bat
 Volume in drive C is OS
 Volume Serial Number is E280-7C84

 Directory of C:\SOAR\SoarWin64\bin

11/03/2012  10:27 AM                79 x-hw-1.bat
               1 File(s)             79 bytes
               0 Dir(s)  240,934,199,296 bytes free

C:\SOAR\SoarWin64\bin>x-hw-1

C:\SOAR\SoarWin64\bin>cli.exe -s 
C:/Soar/SoarWin64/bin/test_agents/hello-world-operator.soar run
**
Total: 2 productions sourced.
     1:    O: O1 (hello-world)
Hello World
System halted.
Interrupt received.This Agent halted.
An agent halted during the run.
C:\SOAR\SoarWin64\bin>x-hw-1

C:\SOAR\SoarWin64\bin>cli.exe -s 
C:/Soar/SoarWin64/bin/test_agents/hello-world-operator.soar run
**
Total: 2 productions sourced.
     1:    O: O1 (hello-world)
Hello World
System halted.
Interrupt received.This Agent halted.
An agent halted during the run.
C:\SOAR\SoarWin64\bin>x-hw-1

C:\SOAR\SoarWin64\bin>cli.exe -s 
C:/Soar/SoarWin64/bin/test_agents/hello-world-operator.soar run
**
Total: 2 productions sourced.
     1:    O: O1 (hello-world)
Hello World
System halted.
Interrupt received.This Agent halted.
An agent halted during the run.
C:\SOAR\SoarWin64\bin>cli /?
Error: No such command: /?

C:\SOAR\SoarWin64\bin>cli -h
usage: cli [-o] [-n <agent name>] [-p <port>] [-s <source>] <commands> ...

C:\SOAR\SoarWin64\bin>cli -h
usage: cli [-o] [-n <agent name>] [-p <port>] [-s <source>] <commands> ...

C:\SOAR\SoarWin64\bin>x-hw-1

C:\SOAR\SoarWin64\bin>cli.exe -s 
C:/Soar/SoarWin64/bin/test_agents/hello-world-operator.soar run
**
Total: 2 productions sourced.
     1:    O: O1 (hello-world)
Hello World
System halted.
Interrupt received.This Agent halted.
An agent halted during the run.
C:\SOAR\SoarWin64\bin>x-hw-2
'x-hw-2' is not recognized as an internal or external command,
operable program or batch file.

C:\SOAR\SoarWin64\bin>x-hw-2

C:\SOAR\SoarWin64\bin>cli.exe -s C:/Soar/SoarWin64/bin/xsrc1.txt
**
Total: 2 productions sourced.

% run
     1:    O: O1 (hello-world)
Hello World
System halted.
Interrupt received.This Agent halted.
An agent halted during the run.

% exit

C:\SOAR\SoarWin64\bin>x-hw-2

C:\SOAR\SoarWin64\bin>cli.exe -s C:/Soar/SoarWin64/bin/xsrc1.txt
     1:    O: O1 (hello-world)
Hello World
System halted.
Interrupt received.This Agent halted.
Error: **
An agent halted during the run.No such command: exit
        C:/Soar/SoarWin64/bin/xsrc1.txt:3
Total: 2 productions sourced.

% quit
Error: No such command: quit

% ?
Available commands:

add-wme
alias
allocate
capture-input
cd
chunk-name-format
clog
command-to-file
default-wme-depth
dirs
echo
echo-commands
edit-production
epmem
excise
explain-backtraces
firing-counts
gds-print
gp
gp-max
help
indifferent-selection
init-soar
internal-symbols
learn
load-library
ls
matches
max-chunks
max-dc-time
max-elaborations
max-goal-depth
max-memory-usage
max-nil-output-cycles
memories
multi-attributes
numeric-indifferent-mode
o-support-mode
popd
port
predict
preferences
print
production-find
pushd
pwatch
pwd
rand
remove-wme
replay-input
rete-net
rl
run
save-backtraces
select
set-library-location
set-stop-phase
smem
soarnews
source
sp
srand
stats
stop-soar
time
timers
unalias
verbose
version
waitsnc
warnings
watch
watch-wmes
wma

% stop-soar

% quit
Error: No such command: quit

% exit

C:\SOAR\SoarWin64\bin>x-hw-2

C:\SOAR\SoarWin64\bin>cli.exe -s C:/Soar/SoarWin64/bin/xsrc1.txt
     1:    O: O1 (hello-world)
Hello World
System halted.
Interrupt received.This Agent halted.
Error: **
An agent halted during the run.No such command: exit
        C:/Soar/SoarWin64/bin/xsrc1.txt:4
Total: 2 productions sourced.

% Terminate batch job (Y/N)? y

C:\SOAR\SoarWin64\bin>x-hw-2

C:\SOAR\SoarWin64\bin>cli.exe -s C:/Soar/SoarWin64/bin/xsrc1.txt
     1:    O: O1 (hello-world)
Hello World
System halted.
Interrupt received.This Agent halted.
Error: **
An agent halted during the run.No such command: exit
        C:/Soar/SoarWin64/bin/xsrc1.txt:4
Total: 2 productions sourced.

% exit

C:\SOAR\SoarWin64\bin>x-hw-2

C:\SOAR\SoarWin64\bin>cli.exe -s C:/Soar/SoarWin64/bin/xsrc1.txt
     1:    O: O1 (hello-world)
Hello World
System halted.
Interrupt received.This Agent halted.
**
An agent halted during the run.Available commands:

add-wme
alias
allocate
capture-input
cd
chunk-name-format
clog
command-to-file
default-wme-depth
dirs
echo
echo-commands
edit-production
epmem
excise
explain-backtraces
firing-counts
gds-print
gp
gp-max
help
indifferent-selection
init-soar
internal-symbols
learn
load-library
ls
matches
max-chunks
max-dc-time
max-elaborations
max-goal-depth
max-memory-usage
max-nil-output-cycles
memories
multi-attributes
numeric-indifferent-mode
o-support-mode
popd
port
predict
preferences
print
production-find
pushd
pwatch
pwd
rand
remove-wme
replay-input
rete-net
rl
run
save-backtraces
select
set-library-location
set-stop-phase
smem
soarnews
source
sp
srand
stats
stop-soar
time
timers
unalias
verbose
version
waitsnc
warnings
watch
watch-wmes
wma

Total: 2 productions sourced.

% exit

C:\SOAR\SoarWin64\bin>x-hw-2

C:\SOAR\SoarWin64\bin>cli.exe -s C:/Soar/SoarWin64/bin/xsrc1.txt
     1:    O: O1 (hello-world)
Hello World
System halted.
Interrupt received.This Agent halted.
Error: **
An agent halted during the run.No such command: %exit
        C:/Soar/SoarWin64/bin/xsrc1.txt:3
Total: 2 productions sourced.

% exit

C:\SOAR\SoarWin64\bin>x-hw-2

C:\SOAR\SoarWin64\bin>cli.exe -s C:/Soar/SoarWin64/bin/xsrc1.txt
     1:    O: O1 (hello-world)
Hello World
System halted.
Interrupt received.This Agent halted.
Error: **
An agent halted during the run.No such command: exit
        C:/Soar/SoarWin64/bin/xsrc1.txt:3
Total: 2 productions sourced.

% exit

C:\SOAR\SoarWin64\bin>x-hw-2

C:\SOAR\SoarWin64\bin>cli.exe -s C:/Soar/SoarWin64/bin/xsrc1.txt
     1:    O: O1 (hello-world)
Hello World
System halted.
Interrupt received.This Agent halted.
Error: **
An agent halted during the run.No such command: quit
        C:/Soar/SoarWin64/bin/xsrc1.txt:3
Total: 2 productions sourced.

% p
apply*hello-world
propose*hello-world

% print
apply*hello-world
propose*hello-world

% help quit
No such command

% help
Available commands:

add-wme
alias
allocate
capture-input
cd
chunk-name-format
clog
command-to-file
default-wme-depth
dirs
echo
echo-commands
edit-production
epmem
excise
explain-backtraces
firing-counts
gds-print
gp
gp-max
help
indifferent-selection
init-soar
internal-symbols
learn
load-library
ls
matches
max-chunks
max-dc-time
max-elaborations
max-goal-depth
max-memory-usage
max-nil-output-cycles
memories
multi-attributes
numeric-indifferent-mode
o-support-mode
popd
port
predict
preferences
print
production-find
pushd
pwatch
pwd
rand
remove-wme
replay-input
rete-net
rl
run
save-backtraces
select
set-library-location
set-stop-phase
smem
soarnews
source
sp
srand
stats
stop-soar
time
timers
unalias
verbose
version
waitsnc
warnings
watch
watch-wmes
wma

% quit
Error: No such command: quit

% stop-soar

% help
Available commands:

add-wme
alias
allocate
capture-input
cd
chunk-name-format
clog
command-to-file
default-wme-depth
dirs
echo
echo-commands
edit-production
epmem
excise
explain-backtraces
firing-counts
gds-print
gp
gp-max
help
indifferent-selection
init-soar
internal-symbols
learn
load-library
ls
matches
max-chunks
max-dc-time
max-elaborations
max-goal-depth
max-memory-usage
max-nil-output-cycles
memories
multi-attributes
numeric-indifferent-mode
o-support-mode
popd
port
predict
preferences
print
production-find
pushd
pwatch
pwd
rand
remove-wme
replay-input
rete-net
rl
run
save-backtraces
select
set-library-location
set-stop-phase
smem
soarnews
source
sp
srand
stats
stop-soar
time
timers
unalias
verbose
version
waitsnc
warnings
watch
watch-wmes
wma

C:\SOAR\SoarWin64\bin>type x-hw-2.bat
cli.exe -s C:/Soar/SoarWin64/bin/xsrc1.txt

C:\SOAR\SoarWin64\bin>x-hw-2.bat

C:\SOAR\SoarWin64\bin>cli.exe -s C:/Soar/SoarWin64/bin/xsrc1.txt
     1:    O: O1 (hello-world)
Hello World
System halted.
Interrupt received.This Agent halted.
Error: **
An agent halted during the run.No such command: quit
        C:/Soar/SoarWin64/bin/xsrc1.txt:3
Total: 2 productions sourced.

% quit
Error: No such command: quit

% exit

C:\SOAR\SoarWin64\bin>

What version of the product are you using? - SoarSuite_9.3.2-Windows_64bit.zip

On what operating system? - Windows 7 64-bit

Please provide any additional information below.

Original issue reported on code.google.com by hfcul...@gmail.com on 3 Nov 2012 at 5:31

GoogleCodeExporter commented 9 years ago
sorry for the long session print-out. (I did not see the previous log entries 
before)

Original comment by hfcul...@gmail.com on 3 Nov 2012 at 5:33

GoogleCodeExporter commented 9 years ago
The commands documented by "help" are commands handled by a Soar agent. "quit" 
and "exit" are not handled because it doesn't make sense to quit or exit an 
agent object instantiated in a program, only the program itself. cli.exe is a 
simple wrapper around an agent object that forwards most commands to it (via 
agent->ExecuteCommandLine()), but it has a special case for "exit" to stop its 
own execution. The incorrect handling of "exit" in cli -s is an oversight on my 
part, and I'll fix this for the next release. In the meantime you can work 
around it by redirecting standard input instead of using the -s flag:

cli <C:/Soar/SoarWin64/bin/xsrc1.txt

This makes cli behave as if you were typing each line from xsrc1.txt into its 
prompt. You don't need an explicit "exit" in the script in this case. Windows 
will close cli's standard input when the end of the script is reached, and cli 
will exit automatically.

Original comment by joseph...@gmail.com on 3 Nov 2012 at 9:20

GoogleCodeExporter commented 9 years ago
Thanks for the assist!

Original comment by hfcul...@gmail.com on 4 Nov 2012 at 3:36