Skip to content
This repository has been archived by the owner on Aug 13, 2022. It is now read-only.

Commit

Permalink
V3.2.1:
Browse files Browse the repository at this point in the history
Add info to readme.md
  • Loading branch information
Pisamad committed Feb 27, 2019
1 parent f89de64 commit 58fa327
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Where:
- `p4Cmd` is the Perforce command (string) with options separated with space.
- `input` is a optional string for input value (like password for login command).

`p4.cmd()` return a promise wich is resolved with the marchal result of the command as an object (`out`).
`p4.cmd()` return a promise wich is resolved with the marchal result of the command as an object (`out`).\
`p4.cmdSync()` return the marchal result of the command as an object (`out`).

`out` has the following structure:
Expand All @@ -59,6 +59,8 @@ When timeout is reached, cmd is rejected and cmdSync is throwed
with a ```P4ApiTimeoutError``` ```Error``` instance
with message like ```'Timeout <timeout>ms reached')```

#### Cancellation feature :
A promise returned by p4.cmd() can be canceled with ```cancel()``` method, killing launched p4 process.


## Examples
Expand Down Expand Up @@ -257,3 +259,16 @@ try {
throw new Error("p4 not found");
}
```

### Cancellation
``` javascript
let p4Promise = p4.cmd("clients");
...
let result = null;
if (DoNotNeedResult) {
p4Promise.cancel();
} else {
result = await p4Promise;
}
```

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "p4api",
"version": "3.2.0",
"version": "3.2.1",
"description": "Simple Perforce API",
"main": "lib/p4api.js",
"scripts": {
Expand Down

0 comments on commit 58fa327

Please sign in to comment.