Permalink
Browse files

[doc] Update README.md

  • Loading branch information...
1 parent b1959d0 commit 9dd9d91fcc4c50e2412261acab5763fb9fdf0347 @indexzero indexzero committed Aug 10, 2011
Showing with 25 additions and 27 deletions.
  1. +25 −27 README.md
View
@@ -4,13 +4,13 @@
## Motivation
-node.js has good built in control for spawning child processes. nexpect builds on these core methods and allows developers to easily pipe data to child processes and assert the expected response. nexpect also chains, so you can compose complex terminal interactions.
+node.js has good built in control for spawning child processes. `nexpect` builds on these core methods and allows developers to easily pipe data to child processes and assert the expected response. `nexpect` also chains, so you can compose complex terminal interactions.
## Installation
### Installing npm (node package manager)
``` bash
- curl http://npmjs.org/install.sh | sh
+ $ curl http://npmjs.org/install.sh | sh
```
### Installing nexpect
@@ -23,44 +23,42 @@ node.js has good built in control for spawning child processes. nexpect builds o
``` js
var nexpect = require('nexpect');
- nexpect.spawn("echo hello")
+ nexpect.spawn("echo", ["hello"])
.expect("hello")
- .run(function(err) {
- if (!err) {
- console.log("hello was echoed");
- }
+ .run(function (err) {
+ if (!err) {
+ console.log("hello was echoed");
+ }
});
- nexpect.spawn("ls -al /tmp/undefined")
+ nexpect.spawn("ls -la /tmp/undefined")
.expect("No such file or directory")
- .run(function(err) {
- if (!err) {
- console.log("checked that file doesn't exists");
- }
+ .run(function (err) {
+ if (!err) {
+ console.log("checked that file doesn't exists");
+ }
});
nexpect.spawn("node")
- .expect("Type '.help' for options.")
- .sendline("console.log('testing')")
- .expect("testing")
- .sendline("process.exit()")
- .run(function(err) {
- if (!err) {
- console.log("node process started, console logged, process exited");
- } else {
- console.log(err)
- }
- });
+ .expect(">")
+ .sendline("console.log('testing')")
+ .expect("testing")
+ .sendline("process.exit()")
+ .run(function (err) {
+ if (!err) {
+ console.log("node process started, console logged, process exited");
+ }
+ else {
+ console.log(err)
+ }
+ });
```
# Authors
[Elijah Insua][2] [Marak Squires][3], and [Charlie Robbins][4].
-
[0]: http://search.cpan.org/~rgiersig/Expect-1.21/Expect.pod "expect"
[1]: http://pexpect.sourceforge.net/pexpect.html "pexpect"
[2]: http://github.com/tmpvar "Elijah Insua"
[3]: http://github.com/marak "Marak Squires"
-[4]: http://github.com/indexzero "Charlie Robbins"
-
-
+[4]: http://github.com/indexzero "Charlie Robbins"

0 comments on commit 9dd9d91

Please sign in to comment.