Skip to content

Commit a340748

Browse files
committed
Merge branch 'dev'
2 parents 81832fd + 832c164 commit a340748

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ The following should be installed on your machine and be added to the path.
2727
|Python | python |
2828
|JavaScript(in node.js environment) | node.js |
2929

30+
The library stores the source files for programs in the home directory in a folder named `.compile-run2`. Make sure you have permissions for this folder.
31+
3032
## Installation
3133

3234
You can install it by using `npm` like below.
@@ -106,6 +108,32 @@ cpp.runFile('E:\\abcd.cpp', (err, result) => {
106108
}
107109
});
108110
```
111+
112+
### - Providing path
113+
114+
```javascript
115+
// Providing custom path in java
116+
java.runFile('E:\\Main.java',{
117+
compilationPath: '<path to javac>',
118+
executionPath: '<path to java>'
119+
},(err,result)=>console.log(err ? err : result));
120+
```
121+
122+
```javascript
123+
//I have 2 versions of python installed 2.7 and 3.6. I can use 3.6 using python3
124+
//to run python3 using compile-run I can do something like
125+
python.runFile('/home/projects/scripts/abc.py',{
126+
executionPath: 'python3'
127+
},(err,result)=>console.log(err ? err : result));
128+
```
129+
130+
```javascript
131+
//If I want to provide custom path of gcc in cpp
132+
cpp.runFile('E:\\abc.cpp',{
133+
compilationPath: '<path to gcc>' // something like C:\\Program Files\\gcc\\bin
134+
},(err,result)=>console.log(err ? err : result));
135+
```
136+
109137
## Result
110138

111139
Result is an object with the following keys:-
@@ -125,6 +153,8 @@ API's offer an optional options object which has following keys:-
125153
1. `stdin` \<string> - Input/stdin you want to pass to the program.
126154
2. `timeout` \<number> - timeout for program execution in milliseconds. Default is 3000 milliseconds.
127155
3. `compileTimeout` - timeout during compilation for c, cpp, java in milliseconds. Default is 3000 milliseconds. Would be ignored if passed for node or python
156+
4. `compilationPath` - path for the compiler for c, cpp and java i.e for gcc and javac respectively. These paths defined by you if provided else defaults would be used.
157+
5. `executionPath` - path for the command to execute the program used in java, python, nodejs i.e for `java`, `python` and `node` respectively. These paths defined by you if provided else defaults would be used.
128158

129159
## Compile-run 1.x.x
130160

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "compile-run",
3-
"version": "2.1.4",
3+
"version": "2.2.1",
44
"description": "You can execute programs in diff languages using this package",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

0 commit comments

Comments
 (0)